private bool TryParseSignature(string txtSignature, out Core.Serialization.Procedure_v1 sProc) { // save the user a keystroke. txtSignature = txtSignature + ";"; var lexer = new Core.CLanguage.CLexer(new StringReader(txtSignature)); var cstate = new Core.CLanguage.ParserState(); var cParser = new CParser(cstate, lexer); try { var decl = cParser.Parse_Decl(); sProc = null; if (decl == null) { return(false); } var syms = new SymbolTable(); syms.AddDeclaration(decl); if (syms.Procedures.Count != 1) { return(false); } sProc = (Core.Serialization.Procedure_v1)syms.Procedures[0]; return(true); } catch { sProc = null; return(false); } }
public void CParser_decl() { Lex(" int x;"); parser.Parse_Decl(); }