Stratego/XT JIRA  History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: STR-82
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Martin Bravenboer
Reporter: Arthur van Dam
Votes: 0
Watchers: 0
Operations

Clone this issue
Create sub-task
If you were logged in you would be able to see more operations.
Stratego/XT

prettyprinting of seq in iter-sep fails

Created: 2004-05-04 13:43   Updated: 2008-03-31 20:39
Component/s: gpp
Affects Version/s: None
Fix Version/s: 0.14

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
I have a syntax definition with a proper pp file, and all installs fine. But when using the prettyprinter (abox2text) on a parsed example file, I receive an error. (All occurs in my TFOF package)

Example file:

module datatypes
  types
  data List a = Cons a (List a)
              | Nil


(relevant part of) SDF:

"data" ConId TypeVarId*
       "=" {(ConId Type*) "|"}+ -> TypeDef {cons("DataType")}

(Note the ConId Type* grouped to form the first argument of the iter-sep.


pp-rules (equal to pp-gen output, but enhanced by hand):

DataType -- H [KW["data"] _1 _2 H [KW["="] V[_3]]],
   DataType.2:iter-star -- _1,
   DataType.3:iter-sep -- H [_1 KW["|"]],
   DataType.3:iter-sep.1:seq -- H hs=1[_1 _2],
   DataType.3:iter-sep.1:seq.2:iter-star -- _1,


Now running the pretty-printer on the (correctly-parsed) example file produces:
  $ parse-tfof -i xmpl/datatypes.tfmd | ast2abox -p pp/TFOF-pretty.pp | abox2text
  No pp entry found for: (2,[""])
  ** ERROR: cannot rewrite to box: ("Nil",[])
  ast2abox: rewriting failed


Apparently the :seq pp-rule is not (properly) used.
A fix for now is to have in my SDF:

ConId Type* -> TypeKind {cons("TypeKind")}
    "data" ConId TypeVarId*
      "=" {TypeKind "|"}+ -> TypeDef {cons("DataType")}


The two :seq entries can be left out of the pp file now, an all works fine. But it still seems like tuples should be supported.

 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.