value type: accept "->" in type tags

Provide a means to dereference pointers when defining tags.  One
example could be:

  %code requires
  {
    typedef struct ListElementType
    {
      union value
      {
        int intVal;
        float floatVal;
        char* charptrVal;
      } value;

      struct ListElementType* next;
    } ListElementType;
  }

  %union
  {
    ListElementType* list;
  }

  %token <list->value.charptrVal> STRING
  %token <list->value.intVal> INTEGER
  %token <list->value.floatVal> REAL
  %type <list> ElementList LiteralType

* src/scan-code.l, src/scan-gram.l: Accept "->" in tags.
* tests/types.at: Add more test cases to cover this case.
This commit is contained in:
Akim Demaille
2013-02-21 15:58:05 +01:00
parent e52ddf820b
commit cb8d8bb9b6
3 changed files with 37 additions and 5 deletions

View File

@@ -572,7 +572,7 @@ eqopt ([[:space:]]*=)?
STRING_GROW;
}
[^<>]+ STRING_GROW;
([^<>]|->)+ STRING_GROW;
"<"+ STRING_GROW; nesting += yyleng;
<<EOF>> unexpected_eof (token_start, ">");