示例#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
        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");
            }
        }