flush
[m6w6/ext-psi] / src / parser_proc.y
index 62e8011992d36fa3d6acb530a0b1e0f3002f7fa2..81a013ceecb7f2e899d31b6feece3b6b0434f3a8 100644 (file)
@@ -15,7 +15,7 @@
 %extra_argument {PSI_Parser *P}
 /* TOKEN is defined inside syntax_error */
 %syntax_error {
-       PSI_ParserSyntaxError(P, P->fn, P->line, "Unexpected token '%s'", TOKEN->text);
+       PSI_ParserSyntaxError(P, P->psi.file.fn, P->line, "Unexpected token '%s'", TOKEN->text);
 }
 
 %nonassoc NAME.
@@ -28,10 +28,10 @@ blocks ::= blocks block.
 block ::= COMMENT.
 
 block ::= LIB(T) QUOTED_STRING(libname) EOS. {
-       if (P->lib) {
-               PSI_ParserSyntaxError(P, P->fn, T->line, "Extra 'lib %s' statement has no effect", libname->text);
+       if (P->psi.file.ln) {
+               PSI_ParserSyntaxError(P, P->psi.file.ln, T->line, "Extra 'lib %s' statement has no effect", libname->text);
        } else {
-               P->lib = strndup(libname->text + 1, libname->size - 2);
+               P->psi.file.ln = strndup(libname->text + 1, libname->size - 2);
        }
        free(libname);
        free(T);
@@ -179,22 +179,6 @@ decl_type(type_) ::= VOID(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
-decl_type(type_) ::= CHAR(T). {
-       type_ = init_decl_type(T->type, T->text);
-       free(T);
-}
-decl_type(type_) ::= SHORT(T). {
-       type_ = init_decl_type(T->type, T->text);
-       free(T);
-}
-decl_type(type_) ::= INT(T). {
-       type_ = init_decl_type(T->type, T->text);
-       free(T);
-}
-decl_type(type_) ::= LONG(T). {
-       type_ = init_decl_type(T->type, T->text);
-       free(T);
-}
 decl_type(type_) ::= FLOAT(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
@@ -203,11 +187,12 @@ decl_type(type_) ::= DOUBLE(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
-decl_type(type_) ::= SIZE_T(T). {
-       type_ = init_decl_type(T->type, T->text);
+/* we have to support plain int here because we have it in our lexer rules */
+decl_type(type_) ::= INT(T). {
+       type_ = init_decl_type(PSI_T_NAME, T->text);
        free(T);
 }
-decl_type(type_) ::= SINT8(T). {
+decl_type(type_) ::= INT8(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
@@ -215,7 +200,7 @@ decl_type(type_) ::= UINT8(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
-decl_type(type_) ::= SINT16(T). {
+decl_type(type_) ::= INT16(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
@@ -223,7 +208,7 @@ decl_type(type_) ::= UINT16(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
-decl_type(type_) ::= SINT32(T). {
+decl_type(type_) ::= INT32(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
@@ -231,7 +216,7 @@ decl_type(type_) ::= UINT32(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
-decl_type(type_) ::= SINT64(T). {
+decl_type(type_) ::= INT64(T). {
        type_ = init_decl_type(T->type, T->text);
        free(T);
 }
@@ -269,23 +254,23 @@ impl_func(func) ::= FUNCTION REFERENCE NSNAME(NAME) impl_args(args) COLON impl_t
 %type impl_def_val {impl_def_val*}
 %destructor impl_def_val {free_impl_def_val($$);}
 impl_def_val(def) ::= NULL(T). {
-       def = init_impl_def_val(T);
+       def = init_impl_def_val(T->type, T->text);
        free(T);
 }
 impl_def_val(def) ::= NUMBER(T). {
-       def = init_impl_def_val(T);
+       def = init_impl_def_val(T->type, T->text);
        free(T);
 }
 impl_def_val(def) ::= TRUE(T). {
-       def = init_impl_def_val(T);
+       def = init_impl_def_val(T->type, T->text);
        free(T);
 }
 impl_def_val(def) ::= FALSE(T). {
-       def = init_impl_def_val(T);
+       def = init_impl_def_val(T->type, T->text);
        free(T);
 }
 impl_def_val(def) ::= QUOTED_STRING(T). {
-       def = init_impl_def_val(T);
+       def = init_impl_def_val(T->type, T->text);
        free(T);
 }