4

I have a grammar rule

factoid:
Element Place
;

That depends on another rule:

Place:
name = ('sea' | 'air')
;

The factoid rule seems to contain identify errors associated with Place:

Multiple markers at this line - Cannot change type twice within a rule - An unassigned rule call is not allowed, when the 'current' was already created.

I have no idea what this means. Can someone explain what this is and how to fix it?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Factor Three
  • 2,094
  • 5
  • 35
  • 51

1 Answers1

5

I think the Element rule generates an object. Since there is no assignment this becomes the current one. The second unassigned rule call to Place would also return an object. But the current pointer contains already the Element type class and can not contain the class Place as well. So what you can try is assigning the Place to a member of factoid, here called location :

factoid:
 item=Element location=Place
;

I am not sure if the assignment of Element to item is required. If Element is not assigned to member then I expect that location would become member of Element or something similar.

deepsubmicron
  • 351
  • 1
  • 4