rev |
line source |
pascal@24080
|
1 from f9f3270a4253144488f87a72bf941f510891dbb1 in https://github.com/blais/xxdiff/
|
pascal@24080
|
2 --- xxdiff-401/src/resParser.cpp
|
pascal@24080
|
3 +++ xxdiff-401/src/resParser.cpp
|
pascal@24080
|
4 @@ -73,7 +73,7 @@ extern int resParserparse( void* );
|
pascal@24080
|
5
|
pascal@24080
|
6 //------------------------------------------------------------------------------
|
pascal@24080
|
7 //
|
pascal@24080
|
8 -void resParsererror( const char* msg )
|
pascal@24080
|
9 +void resParsererror( XxResources *, const char* msg )
|
pascal@24080
|
10 {
|
pascal@24080
|
11 // Send errors to stdout so we can filter out the debug info shmeglu while
|
pascal@24080
|
12 // debugging parser.
|
pascal@24080
|
13 @@ -794,7 +794,7 @@ int parseFromKeywordList(
|
pascal@24080
|
14 QString os;
|
pascal@24080
|
15 QTextStream oss( &os );
|
pascal@24080
|
16 oss << "Unknown " << errmsg << ": " << name << flush;
|
pascal@24080
|
17 - resParsererror( os.toLatin1().constData() );
|
pascal@24080
|
18 + resParsererror( NULL, os.toLatin1().constData() );
|
pascal@24080
|
19 }
|
pascal@24080
|
20 num = ERROR_TOKEN;
|
pascal@24080
|
21 return ERROR_TOKEN;
|
pascal@24080
|
22 --- xxdiff-401/src/resParser.l
|
pascal@24080
|
23 +++ xxdiff-401/src/resParser.l
|
pascal@24080
|
24 @@ -76,7 +76,7 @@ if ( input_stream_ptr->atEnd() ) {
|
pascal@24080
|
25 result = YY_NULL; \
|
pascal@24080
|
26 } \
|
pascal@24080
|
27 else { \
|
pascal@24080
|
28 - int ii = 0; \
|
pascal@24080
|
29 + unsigned ii = 0; \
|
pascal@24080
|
30 for ( ; (ii < max_size) && (!input_stream_ptr->atEnd()); ++ii ) { \
|
pascal@24080
|
31 (*input_stream_ptr) >> buf[ii]; \
|
pascal@24080
|
32 } \
|
pascal@24080
|
33 --- xxdiff-401/src/resParser.y
|
pascal@24080
|
34 +++ xxdiff-401/src/resParser.y
|
pascal@24080
|
35 @@ -20,11 +20,6 @@
|
pascal@24080
|
36 *
|
pascal@24080
|
37 ******************************************************************************/
|
pascal@24080
|
38
|
pascal@24080
|
39 -%union
|
pascal@24080
|
40 -{
|
pascal@24080
|
41 - int num;
|
pascal@24080
|
42 - char* str;
|
pascal@24080
|
43 -}
|
pascal@24080
|
44 %{
|
pascal@24080
|
45
|
pascal@24080
|
46 // xxdiff imports
|
pascal@24080
|
47 @@ -39,12 +34,22 @@
|
pascal@24080
|
48
|
pascal@24080
|
49 // The parser input is the resources object to fill in.
|
pascal@24080
|
50 #define RESOURCES ( static_cast<XxResources*>(resources) )
|
pascal@24080
|
51 -#define YYPARSE_PARAM resources
|
pascal@24080
|
52 +%}
|
pascal@24080
|
53 +
|
pascal@24080
|
54 +%define api.pure full
|
pascal@24080
|
55 +%parse-param {XxResources * resources}
|
pascal@24080
|
56
|
pascal@24080
|
57 +%union
|
pascal@24080
|
58 +{
|
pascal@24080
|
59 + int num;
|
pascal@24080
|
60 + char* str;
|
pascal@24080
|
61 +}
|
pascal@24080
|
62 +
|
pascal@24080
|
63 +%{
|
pascal@24080
|
64 // Declare lexer from other compilation unit.
|
pascal@24080
|
65 int resParserlex( YYSTYPE* yylval );
|
pascal@24080
|
66
|
pascal@24080
|
67 -void resParsererror( const char* msg );
|
pascal@24080
|
68 +void resParsererror( XxResources *, const char* msg );
|
pascal@24080
|
69
|
pascal@24080
|
70 // Declare some parser functions and data defined in resParser.cpp
|
pascal@24080
|
71 namespace XxResParserNS {
|
pascal@24080
|
72 @@ -144,7 +149,6 @@ using namespace XxResParserNS; // Make s
|
pascal@24080
|
73 %type <num> boolkwd
|
pascal@24080
|
74
|
pascal@24080
|
75 %start xxdiffrc
|
pascal@24080
|
76 -%pure_parser
|
pascal@24080
|
77
|
pascal@24080
|
78 %%
|
pascal@24080
|
79 xxdiffrc : stmts
|
pascal@24080
|
80 @@ -188,7 +192,7 @@ prefgeometry : PREFGEOMETRY COLON GEOMSP
|
pascal@24080
|
81 RESOURCES->setPreferredGeometry( geometry );
|
pascal@24080
|
82 }
|
pascal@24080
|
83 else {
|
pascal@24080
|
84 - yyerror( "Bad geometry specification." );
|
pascal@24080
|
85 + yyerror( NULL, "Bad geometry specification." );
|
pascal@24080
|
86 // Should never happen, the lexer regexp should be tough
|
pascal@24080
|
87 // enough.
|
pascal@24080
|
88 }
|
pascal@24080
|
89 @@ -212,7 +216,7 @@ style : STYLE COLON STRING
|
pascal@24080
|
90 QString err = QString( "Requested style key does not exist." );
|
pascal@24080
|
91 err += QString( "\nValid styles are: " );
|
pascal@24080
|
92 err += styles.join( ", " );
|
pascal@24080
|
93 - yyerror( err.toLatin1().constData() );
|
pascal@24080
|
94 + yyerror( NULL, err.toLatin1().constData() );
|
pascal@24080
|
95 }
|
pascal@24080
|
96 }
|
pascal@24080
|
97 ;
|
pascal@24080
|
98 @@ -224,7 +228,7 @@ accel : ACCEL DOT ACCELNAME COLON STRIN
|
pascal@24080
|
99 char buf[2048];
|
pascal@24080
|
100 ::snprintf( buf, 2048,
|
pascal@24080
|
101 "Unrecognized accelerator: %s\n", $5 );
|
pascal@24080
|
102 - yyerror( buf );
|
pascal@24080
|
103 + yyerror( NULL, buf );
|
pascal@24080
|
104 }
|
pascal@24080
|
105 }
|
pascal@24080
|
106 ;
|