Kaynağa Gözat

updated grammar + added some types

master
Nathan R 3 yıl önce
ebeveyn
işleme
31f4d9ed14
1 değiştirilmiş dosya ile 14 ekleme ve 6 silme
  1. +14
    -6
      ccmeta.leg

+ 14
- 6
ccmeta.leg Dosyayı Görüntüle

@ -1405,6 +1405,8 @@ declaration = @{ C_declarationBegin() }
declarationSpecifiers = @{ int specified= 0 } { listBegin() }
( s:storageClassSpecifier { listAppend(s) }
| s:typeSpecifier @{ specified++ } { listAppend(s) }
# Any list of specifiers and qualifiers at the start of a declaration may contain attribute specifiers
| s:attributeSpecifier &{gnu} { listAppend(s) }
| s:typedefName &{ !specified++ } { listAppend(s) }
| s:typeQualifier { listAppend(s) }
| s:functionSpecifier { listAppend(s) }
@ -1418,7 +1420,7 @@ initDeclaratorList = d:initDeclarator { listWith(d) }
)* { $$= listEnd() }
initDeclarator = d:declarator
( a:ASSIGN i:initializer { d= new_C_binary(d, a, i) }
( a:ASSIGN i:initializer &{ !typedeffing } { d= new_C_binary(d, a, i) }
)? { $$= d }
# 6.7.1
@ -1434,11 +1436,10 @@ functionStorageClassSpecifier = EXTERN | STATIC
# 6.7.2
typeSpecifier = VOID | CHAR | SHORT | INT | LONG | FLOAT | DOUBLE | SIGNED | UNSIGNED | BOOL | COMPLEX
typeSpecifier = VOID | CHAR | SHORT | INT | LONG | FLOAT | DOUBLE | SIGNED | UNSIGNED | BOOL | COMPLEX
| ( BUILTIN_VA_LIST | _FLOAT128 )
| structOrUnionSpecifier
| enumSpecifier
# Any list of specifiers and qualifiers at the start of a declaration may contain attribute specifiers
| attributeSpecifier &{gnu}
# 6.7.2.1
@ -1510,11 +1511,13 @@ enumerator = i:id
# 6.7.3
typeQualifier = CONST | RESTRICT | VOLATILE
typeQualifier = CONST | RESTRICT | VOLATILE
| __RESTRICT
# 6.7.4
functionSpecifier = INLINE
| __INLINE
# 6.7.5
@ -1710,7 +1713,7 @@ externalDeclaration = { yylval = newComment(yytext); }
| ( SEMI &{gnu}
| declaration
| functionDefinition
#| | meta
| meta
| &. &{ errmsg= "declaration expected" } error
) { yylval= $$; }
@ -1943,6 +1946,11 @@ IMAG = '__imag__' !IDREST &{gnu} { $$= newToken("__imag__" ) } -
LABEL = '__label__' !IDREST &{gnu} { $$= newToken("__label__") } -
REAL = '__real__' !IDREST &{gnu} { $$= newToken("__real__" ) } -
BUILTIN_VA_LIST = '__builtin_va_list' !IDREST &{gnu} { $$= newToken("__builtin_va_list" ) } -
__RESTRICT = '__restrict' !IDREST &{gnu} { $$= newToken("__restrict" ) } -
__INLINE = '__inline' !IDREST &{gnu} { $$= newToken("__inline" ) } -
_FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float128" ) } -
%%
;

Yükleniyor…
İptal
Kaydet