- | integer_literal
- | real_literal
- | LITERAL_CHARACTER { $$ = new CharLiteral ((char) lexer.Value, lexer.Location); }
- | LITERAL_STRING { $$ = new StringLiteral ((string) lexer.Value, lexer.Location); }
- | NULL { $$ = new NullLiteral (lexer.Location); }
- ;
-
-real_literal
- : LITERAL_FLOAT { $$ = new FloatLiteral ((float) lexer.Value, lexer.Location); }
- | LITERAL_DOUBLE { $$ = new DoubleLiteral ((double) lexer.Value, lexer.Location); }
- | LITERAL_DECIMAL { $$ = new DecimalLiteral ((decimal) lexer.Value, lexer.Location); }
- ;
-
-integer_literal
- : LITERAL_INTEGER {
- object v = lexer.Value;
-
- if (v is int){
- $$ = new IntLiteral ((int) v, lexer.Location);
- } else if (v is uint)
- $$ = new UIntLiteral ((UInt32) v, lexer.Location);
- else if (v is long)
- $$ = new LongLiteral ((Int64) v, lexer.Location);
- else if (v is ulong)
- $$ = new ULongLiteral ((UInt64) v, lexer.Location);
- else
- Console.WriteLine ("OOPS. Unexpected result from scanner");
- }