public CodeBlockNode GenerateAST(string pathFilename, ProtoCore.Core core) { Imperative.Scanner s = new Imperative.Scanner(pathFilename); Imperative.Parser p = new Imperative.Parser(s, core); p.Parse(); return(p.codeblock as CodeBlockNode); }
public CodeBlockNode GenerateAST(string pathFilename, ProtoCore.Core core) { Imperative.Scanner s = new Imperative.Scanner(pathFilename); Imperative.Parser p = new Imperative.Parser(s, core); p.Parse(); return p.codeblock as CodeBlockNode; }
private void ParseLanguageBlockNode(LanguageBlockNode langblock) { if (!core.langverify.Verify(langblock.codeblock)) { return; } ProtoCore.ParserBase parser = null; System.IO.MemoryStream memstream = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(langblock.codeblock.body)); if (langblock.codeblock.language == ProtoCore.Language.kImperative) { parser = new Imperative.Parser(new Imperative.Scanner(memstream), core); } else if (langblock.codeblock.language == ProtoCore.Language.kAssociative) { parser = new Associative.Parser(new Associative.Scanner(memstream), core); } try { parser.errorStream = new System.IO.StringWriter(); parser.Parse(); if (parser.errorStream.ToString() != String.Empty) { core.BuildStatus.LogSyntaxError(parser.errorStream.ToString()); } core.BuildStatus.errorCount += parser.errorCount; langblock.codeBlockNode = parser.codeblock; } catch (ProtoCore.BuildHaltException e) { System.Console.WriteLine(e.errorMsg); } }
private void ParseLanguageBlockNode(LanguageBlockNode langblock) { if (!core.langverify.Verify(langblock.codeblock)) { return; } ProtoCore.ParserBase parser = null; System.IO.MemoryStream memstream = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(langblock.codeblock.body)); if (langblock.codeblock.language == ProtoCore.Language.kImperative) { parser = new Imperative.Parser(new Imperative.Scanner(memstream), core); } else if (langblock.codeblock.language == ProtoCore.Language.kAssociative) { parser = new Associative.Parser(new Associative.Scanner(memstream), core); } try { parser.errorStream = new System.IO.StringWriter(); parser.Parse(); if (parser.errorStream.ToString() != String.Empty) core.BuildStatus.LogSyntaxError(parser.errorStream.ToString()); core.BuildStatus.errorCount += parser.errorCount; langblock.codeBlockNode = parser.codeblock; } catch (ProtoCore.BuildHaltException e) { System.Console.WriteLine(e.errorMsg); } }