public void AddTypeSynonym(string contents) { Match match = Regex.Match(contents, @"^\s*type\s+([^\s<(=]+)"); if (match.Success) { string name = match.Groups[1].Value; AddTopLevelDecl((TypeSynonymDecl)AH.ParseTopLevelDecl(prog, name, contents)); } else { AH.PrintError(prog, $"Could not find type synonym name in {contents}"); } }
public void AddFunction(string contents) { Match match = Regex.Match(contents, @"^\s*function\s+({[^}]*}\s*)*([^\s<(]+)"); if (match.Success) { string name = match.Groups[2].Value; AddDefaultClassDecl((Function)AH.ParseTopLevelDecl(prog, name, contents)); } else { AH.PrintError(prog, $"Could not find function name in {contents}"); } }
public void AddDatatype(string contents, string auxName = null) { Match match = Regex.Match(contents, @"^\s*datatype\s+([^\s<(]+)"); if (match.Success) { string name = match.Groups[1].Value; AddTopLevelDecl((DatatypeDecl)AH.ParseTopLevelDecl(prog, name, contents), auxName); } else { AH.PrintError(prog, $"Could not find datatype name in {contents}"); } }
public void AddPredicate(string contents) { Match match = Regex.Match(contents, @"^\s*predicate\s+({[^}]*}\s*)*([^\s<(]+)"); if (match.Success) { string name = match.Groups[2].Value; AddDefaultClassDecl((Predicate)AH.ParseTopLevelDecl(prog, name, contents)); } else { AH.PrintError(prog, $"Could not find predicate name in {contents}"); return; } }
public void AddLemma(string contents, string auxName = null) { Match match = Regex.Match(contents, @"^\s*lemma\s+([^\s<(]+)"); if (match.Success) { string name = match.Groups[1].Value; string expandedContents = InsertExtraMaterial(name, contents); AddDefaultClassDecl((Lemma)AH.ParseTopLevelDecl(prog, name, expandedContents), auxName); } else { AH.PrintError(prog, $"Could not find lemma name in {contents}"); } }