Esempio n. 1
0
 Ast.Expression GetArgVal(FtlParserStream ps)
 {
     if (ps.IsNumberStart())
     {
         return(GetNumber(ps));
     }
     else if (ps.CurrentIs('"'))
     {
         return(GetString(ps));
     }
     throw new ParseException("E0012");
 }
Esempio n. 2
0
        Ast.Expression _GetLiteral(FtlParserStream ps)
        {
            var ch = ps.Current;

            if (ch == Eof)
            {
                throw new ParseException("E0014");
            }

            if (ch == '$')
            {
                ps.Next();
                var id = GetIdentifier(ps);
                return(new Ast.VariableReference(id));
            }

            if (ps.IsIdentifierStart())
            {
                var name = GetIdentifier(ps);
                return(new Ast.MessageReference(name));
            }

            if (ps.IsNumberStart())
            {
                return(GetNumber(ps));
            }

            if (ch == '-')
            {
                var id = GetTermIdentifier(ps);
                return(new Ast.TermReference(id));
            }

            if (ch == '"')
            {
                return(GetString(ps));
            }

            throw new ParseException("E0014");
        }