Sha256: 12dffc87936719325293f3f57ed7df5d6a7c0d80001f4cb408b3fb89e5c34723

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 Bytes

Contents

grammar XdrEnumGrammar

  rule enum_def
    "enum" space 
    identifier space? 
    enum_body space? 
    ";"
    <Xdrgen::AST::Definitions::Enum>
  end


  rule enum_body
    "{" 
    space? 
    first_member_n:enum_member
    additional_members_n:(space? "," space? enum_member )*
    space?
    "}"
  end

  rule enum_type_spec
    "enum" space enum_body
    <Xdrgen::AST::Definitions::NestedEnum>
  end

  rule enum_member
    identifier 
    space? 
    value_n:enum_value?
    <Xdrgen::AST::Definitions::EnumMember>
  end

  rule enum_value
    "=" 
    space? 
    val:(enum_value_constant / enum_value_alias)
  end

  rule enum_value_constant
    constant
  end

  rule enum_value_alias
    identifier
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xdrgen-0.1.1 lib/xdrgen/grammar/enum.treetop
xdrgen-0.1.0 lib/xdrgen/grammar/enum.treetop
xdrgen-0.0.1 lib/xdrgen/grammar/enum.treetop