Add long, short, unsigned

edge_only_predecessors
Max Brunsfeld 2014-09-06 18:27:58 +07:00
parent af4466ace2
commit ebcf79c462
2 changed files with 12 additions and 3 deletions

@ -64,11 +64,18 @@ module.exports = compiler.grammar
type: -> seq( type: -> seq(
optional(keyword("const")), optional(keyword("const")),
choice( choice(
@identifier, @primitive_type,
@struct_type, @struct_type,
@enum_type, @enum_type,
@union_type)) @union_type))
primitive_type: -> seq(
optional(repeat(choice(
keyword("unsigned"),
keyword("short"),
keyword("long")))),
@identifier)
formal_parameters: -> formal_parameters: ->
err(commaSep(@field)) err(commaSep(@field))

@ -61,13 +61,15 @@ enum e2 {
Primitive-typed variable declarations Primitive-typed variable declarations
============================================ ============================================
int a; unsigned short int a;
long int b;
float d, e; float d, e;
--- ---
(program (program
(var_declaration (identifier) (identifier)) (var_declaration (primitive_type (identifier)) (identifier))
(var_declaration (primitive_type (identifier)) (identifier))
(var_declaration (identifier) (identifier) (identifier))) (var_declaration (identifier) (identifier) (identifier)))
============================================ ============================================