bnf and ebnf printer: align ::= symbols.

This commit is contained in:
bjorn
2008-09-26 09:54:09 +00:00
parent 93e9d60765
commit d54ba6f112
2 changed files with 11 additions and 4 deletions

View File

@@ -175,9 +175,9 @@ ungroupTokens = joinRE . mapRE (symbol (RESymbol . NonTerminal) (REConcat . map
--
prSRG :: SRG -> String
prSRG = unlines . map prRule . srgRules
prSRG = prProductions . map prRule . srgRules
where
prRule (SRGRule c alts) = c ++ " ::= " ++ unwords (intersperse "|" (map prAlt alts))
prRule (SRGRule c alts) = (c,unwords (intersperse "|" (map prAlt alts)))
prAlt (SRGAlt _ _ rhs) = prRE prSym rhs
prSym = symbol fst (\t -> "\""++ t ++"\"")