当前位置: 首页>>代码示例>>C#>>正文


C# ErrorHandler.getErrors方法代码示例

本文整理汇总了C#中ErrorHandler.getErrors方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorHandler.getErrors方法的具体用法?C# ErrorHandler.getErrors怎么用?C# ErrorHandler.getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorHandler的用法示例。


在下文中一共展示了ErrorHandler.getErrors方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ForgettingEndStatement

        public void ForgettingEndStatement()
        {
            Tokenizer t = new Tokenizer(s_errorHandler, true);
            ErrorHandler e = new ErrorHandler();
            Parser p = new Parser(t.process(File.OpenText("code68.txt")), e);
            p.process();

            ScopeBuilder scopeBuilder = new ScopeBuilder(p.getAST(), e);
            scopeBuilder.process();

            e.printErrorsToConsole();

            Assert.AreEqual(1, e.getErrors().Count);
        }
开发者ID:bloomingbridges,项目名称:hxSprak,代码行数:14,代码来源:ScopeBuilder_TEST.cs

示例2: ParseSomeExpressionsWithFunctions

        public void ParseSomeExpressionsWithFunctions()
        {
            Tokenizer tokenizer = new Tokenizer(s_errorHandler, true);
            List<Token> tokens = tokenizer.process(File.OpenText("code15.txt"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            //Console.WriteLine("Tree: " + parser.getAST().getTreeAsString());

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:13,代码来源:Parser_TEST.cs

示例3: ParseSimpleExpression

        public void ParseSimpleExpression()
        {
            List<Token> tokens = new List<Token>();
            tokens.Add(new Token(Token.TokenType.NAME, "a"));
            tokens.Add(new Token(Token.TokenType.OPERATOR, "+"));
            tokens.Add(new Token(Token.TokenType.NAME, "b"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:13,代码来源:Parser_TEST.cs

示例4: ParseSingleName

        public void ParseSingleName()
        {
            List<Token> tokens = new List<Token>();
            tokens.Add(new Token(Token.TokenType.NAME, "erik"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:11,代码来源:Parser_TEST.cs

示例5: ParseLongerExpression

        public void ParseLongerExpression()
        {
            List<Token> tokens = new List<Token>();

            tokens.Add(new Token(Token.TokenType.NUMBER, "2"));
            tokens.Add(new Token(Token.TokenType.OPERATOR, "*"));
            tokens.Add(new Token(Token.TokenType.NUMBER, "3"));
            tokens.Add(new Token(Token.TokenType.OPERATOR, "+"));
            tokens.Add(new Token(Token.TokenType.NUMBER, "4"));
            tokens.Add(new Token(Token.TokenType.OPERATOR, "*"));
            tokens.Add(new Token(Token.TokenType.NUMBER, "5"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:18,代码来源:Parser_TEST.cs

示例6: ParseIfElseBlock

        public void ParseIfElseBlock()
        {
            List<Token> tokens = new List<Token>();

            tokens.Add(new Token(Token.TokenType.IF, "if"));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_LEFT, "("));
            tokens.Add(new Token(Token.TokenType.NAME, "m_hasGotCandy"));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_RIGHT, ")"));
            tokens.Add(new Token(Token.TokenType.NEW_LINE, "\n"));
            tokens.Add(new Token(Token.TokenType.NAME, "boringFunction"));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_LEFT, "("));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_RIGHT, ")"));
            tokens.Add(new Token(Token.TokenType.NEW_LINE, "\n"));
            tokens.Add(new Token(Token.TokenType.BLOCK_END, "end"));
            tokens.Add(new Token(Token.TokenType.ELSE, "else"));
            tokens.Add(new Token(Token.TokenType.NEW_LINE, "\n"));
            tokens.Add(new Token(Token.TokenType.BLOCK_END, "end"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:24,代码来源:Parser_TEST.cs

示例7: ParseFunctionDeclaration

        public void ParseFunctionDeclaration()
        {
            List<Token> tokens = new List<Token>();

            tokens.Add(new Token(Token.TokenType.BUILT_IN_TYPE_NAME, "float"));
            tokens.Add(new Token(Token.TokenType.NAME, "foo"));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_LEFT, "("));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_RIGHT, ")"));
            tokens.Add(new Token(Token.TokenType.BLOCK_END, "end"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            Console.WriteLine("Tree: " + parser.getAST().getTreeAsString());
            errorHandler.printErrorsToConsole();

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:19,代码来源:Parser_TEST.cs

示例8: ParseFunctionCallWithParameters

        public void ParseFunctionCallWithParameters()
        {
            List<Token> tokens = new List<Token>();

            tokens.Add(new Token(Token.TokenType.NAME, "foo"));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_LEFT, "("));
            tokens.Add(new Token(Token.TokenType.NAME, "a"));
            tokens.Add(new Token(Token.TokenType.COMMA, ","));
            tokens.Add(new Token(Token.TokenType.NAME, "bar"));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_LEFT, "("));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_RIGHT, ")"));
            tokens.Add(new Token(Token.TokenType.COMMA, ","));
            tokens.Add(new Token(Token.TokenType.NUMBER, "400"));
            tokens.Add(new Token(Token.TokenType.PARANTHESIS_RIGHT, ")"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:21,代码来源:Parser_TEST.cs

示例9: ParseAssignment

        public void ParseAssignment()
        {
            List<Token> tokens = new List<Token>();
            tokens.Add(new Token(Token.TokenType.NAME, "variable"));
            tokens.Add(new Token(Token.TokenType.ASSIGNMENT, "="));
            tokens.Add(new Token(Token.TokenType.NUMBER, "42"));

            ErrorHandler errorHandler = new ErrorHandler();
            Parser parser = new Parser(tokens, errorHandler);
            parser.process();

            Assert.AreEqual(0, errorHandler.getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:13,代码来源:Parser_TEST.cs


注:本文中的ErrorHandler.getErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。