]> git.saurik.com Git - cycript.git/commitdiff
Support (ignore) __restrict/restrict and throw ().
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 23 Dec 2015 01:04:08 +0000 (17:04 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 23 Dec 2015 01:04:08 +0000 (17:04 -0800)
Parser.ypp.in
Scanner.lpp.in

index 50ee7445701740586b34f581210dd9d6786b4f0c..ac4237301acdac380f886f6c829b79e760304e96 100644 (file)
@@ -424,6 +424,8 @@ type; })
 %token ___proto___ "__proto__"
 %token _prototype_ "prototype"
 %token _public_ "public"
+%token ___restrict_ "__restrict"
+%token _restrict_ "restrict"
 %token _set_ "set"
 %token _short_ "short"
 %token _static_ "static"
@@ -661,6 +663,7 @@ type; })
 %type <typedIdentifier_> TypeSignifier
 %type <typedIdentifier_> TypeSignifierNone
 %type <typedIdentifier_> TypeSignifierOpt
+%type <modifier_> ParameterTail
 %type <modifier_> TypeQualifierLeft
 %type <modifier_> TypeQualifierLeftOpt
 %type <typedIdentifier_> TypeQualifierRight
@@ -987,6 +990,8 @@ IdentifierNoOf
     | "char" { $$ = CYNew CYIdentifier("char"); }
     | "int" { $$ = CYNew CYIdentifier("int"); }
     | "long" { $$ = CYNew CYIdentifier("long"); }
+    | "__restrict" { $$ = CYNew CYIdentifier("__restrict"); }
+    | "restrict" { $$ = CYNew CYIdentifier("restrict"); }
     | "short" { $$ = CYNew CYIdentifier("short"); }
     | "static" { $$ = CYNew CYIdentifier("static"); }
     | "volatile" { $$ = CYNew CYIdentifier("volatile"); }
@@ -1991,11 +1996,34 @@ TypeSignifierOpt
     | TypeSignifierNone[pass] { $$ = $pass; }
     ;
 
+Restrict
+    : "__restrict"
+    | "restrict"
+    ;
+
+RestrictOpt
+    : Restrict
+    |
+    ;
+
+ParameterModifier
+    : "throw" "(" ")"
+    ;
+
+ParameterModifierOpt
+    : ParameterModifier
+    |
+    ;
+
+ParameterTail
+    : TypedParameterListOpt[parameters] ")" ParameterModifierOpt { $$ = CYNew CYTypeFunctionWith($parameters); }
+    ;
+
 SuffixedType
-    : SuffixedTypeOpt[typed] "[" NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
+    : SuffixedTypeOpt[typed] "[" RestrictOpt NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
     | "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameterListOpt[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
-    | TypeSignifier[typed] "(" TypedParameterListOpt[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeFunctionWith($parameters, $$->modifier_); }
-    | "("[parenthesis] TypedParameterListOpt[parameters] ")" { $$ = CYNew CYTypedIdentifier(@parenthesis); $$->modifier_ = CYNew CYTypeFunctionWith($parameters, $$->modifier_); }
+    | TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
+    | "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedIdentifier(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
     ;
 
 SuffixedTypeOpt
@@ -2022,6 +2050,7 @@ TypeQualifierRight
     | PrefixedType[pass] { $$ = $pass; }
     | "const" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
     | "volatile" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
+    | Restrict TypeQualifierRightOpt[typed] { $$ = $typed; }
     ;
 
 TypeQualifierRightOpt
index bb533e06343d701c221fbea06efa40f7db3698be..7df83885fd9e822c1d81770e0915f9088552c0ea 100644 (file)
@@ -494,6 +494,8 @@ XMLName {XMLNameStart}{XMLNamePart}*
 "__proto__"       L /*III*/ F(tk::___proto___, hi::Special);
 "prototype"       L /*III*/ F(tk::_prototype_, hi::Special);
 "public"          L /*FSS*/ F(tk::_public_, hi::Meta);
+"__restrict"      L /*III*/ F(tk::___restrict_, hi::Meta);
+"restrict"        L /*III*/ F(tk::_restrict_, hi::Meta);
 "return"          L /*KKK*/ F(tk::_return_, hi::Control);
 "set"             L /*III*/ F(tk::_set_, hi::Meta);
 "short"           L /*FII*/ F(tk::_short_, hi::Type);