예제 #1
0
 public IdentifierAST ParseIdentifier()
 {
     if (Tok() != TokenType.String && Tok() != TokenType.QuotedString)
         throw new Exception(GetErrorMsg());
     var ast = new IdentifierAST();
     ast.value = Inc();
     return ast;
 }
예제 #2
0
        private AST ParseIdentifierRef(List <string> ns)
        {
            if (ns != null && !ns.Contains(_lexer.CurrentToken.Value))
            {
                throw new Exception($"Parameter {_lexer.CurrentToken.Value} is not defined");
            }

            var node = new IdentifierAST(_lexer.CurrentToken.Value);

            _lexer.AcceptToken(TokenType.Identifier);
            return(node);
        }
예제 #3
0
        public static PBXElementString ParseIdentifierAST(IdentifierAST ast, TokenList tokens, string text)
        {
            Token  tok = tokens[ast.value];
            string value;

            switch (tok.type)
            {
            case TokenType.String:
                value = text.Substring(tok.begin, tok.end - tok.begin);
                return(new PBXElementString(value));

            case TokenType.QuotedString:
                value = text.Substring(tok.begin, tok.end - tok.begin);
                value = PBXStream.UnquoteString(value);
                return(new PBXElementString(value));

            default:
                throw new Exception("Internal parser error");
            }
        }
예제 #4
0
파일: Compile.cs 프로젝트: Stu042/SimpleC
 public object DoForIdentifier(IdentifierAST id, object options = null)
 {
     Console.WriteLine("(IdentifierAST)" + id.token.value);
     return(options);
 }
예제 #5
0
파일: Parser.cs 프로젝트: Stu042/SimpleC
 public object DoForIdentifier(IdentifierAST id, object options = null)
 {
     PositionOutput(id.token.indent);
     ConsoleEx.WriteLine("{0}(IdentifierAST) {1}{2}", ConsoleColor.DarkBlue, ConsoleColor.Gray, id.token.value);
     return(options);
 }