Пример #1
0
 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);
 }
Пример #2
0
 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;
 }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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);
            }
        }