Parenthesis are needed

Top  Previous  Next

Messages > Parenthesis are needed

 

You get the warning: Parenthesis are needed, if the first semantic action contains a variable declaration for the whole production, for productions of the kind

 

{-...-}

A | B ...

 

Frequently the first semantic action contains declarations of variables, which shall be used in all alternatives. But then, you have to put the alternatives into parenthesis. E.g.:

 

{- str s; -}

(

"a" | "b"

)

{-return s;-}

 

Without parenthesis

 

{- str s; -}

"a"

| "b"

{-return s;-}

 

 

you get the error message:

 

Unknown identifier: s

 

for {-return s;-}, because there are implicit parenthesis like

 

 

(

{- str s; -}

"a"

)

|

(

"b"

{-return s;-}

)

 



This page belongs to the TextTransformer Documentation

Home  Content  German