Skip to content

Commit d02d780

Browse files
committed
Make #494 work for C++ without namespaces
1 parent 103a830 commit d02d780

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/src/BNFC/Backend/C/CFtoBisonC.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ errorHandler mode = case mode of
179179
, " loc->first_line, loc->first_column, msg, " ++ name ++ "get_text(scanner));"
180180
, "}"
181181
]
182-
CppParser _ _ ->
182+
CppParser ns _ ->
183183
-- This generates error handler for C++ with throw parse_error
184184
unlines
185185
[ "void yyerror(YYLTYPE *loc, yyscan_t scanner, YYSTYPE *result, const char *msg)"
@@ -192,7 +192,7 @@ errorHandler mode = case mode of
192192
, " if (scanner) {"
193193
, " error_msg += \": '\" + std::string(" ++ name ++ "get_text(scanner)) + \"'\";"
194194
, " }"
195-
, " throw " ++ name ++ "::parse_error(loc ? loc->first_line : -1, error_msg);"
195+
, " throw " ++ maybe "" (++ "::") ns ++ "parse_error(loc ? loc->first_line : -1, error_msg);"
196196
, "}"
197197
]
198198
where

0 commit comments

Comments
 (0)