nibags created this revision.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: Frameworks.
nibags requested review of this revision.
REVISION SUMMARY
Hi
The Yacc/Bison file highlights as 'dsError' the '$' symbol (it is used as
pseudo-variable). The problem comes from the 'isocpp.xml' file of C++, which
highlights it as 'Error' (probably, this was added to the C++ file later).
data/syntax/yacc.xml (lines 131 & 132):
131|
132|
133|
autotests/reference/highlight.y.ref :
35| […] ($2)
[...]
40| $$ […]
That is corrected. Also, this file is outdated for Bison. Therefore, it is
updated according to the parser of the latest version of Bison (3.0.4).
Changes/fixes for Bison:
- Add declarations that contain blocks of code that are not currently
highlighted. For example: %code { C++ code... } %destructor { C++ code, with
symbols $… } %initial-action { C++ code, with symbols $… }
- Add the Bison variable '@' (@$, @n, @[name], $@n).
- Add directives in rules: %?{ expr…}, %empty, %prec, %dprec and %merge.
- Allow a tag in %union declarations. Ex: %union tag { code … }
- Allow grammar declarations in the grammar rules section, such as: %union,
%code, %type, etc.
- Allow declarations in multiple lines. Ex: %token PERCENT_DEBUG
"%debug" PERCENT_DEFAULT_PREC"%default-prec" ;
- The ';' char is not necessary to finish a rule. Allow ';' followed by ‘|’,
within a rule (See line 603 in the “src/parse-gram.y” file, from the Bison
3.0.4 source [2]).
- Add the mimetypes (text/x-yacc, text/x-bison) and the extensions '.ypp' &
'.y++' [3].
I hope these changes are useful.
Any inconvenience (as if it is necessary to contact the original author of
the file to approve the changes), do not hesitate to notify.
Source:
[1] https://www.gnu.org/software/bison/manual/html_node/Table-of-Symbols.html
[2] https://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz ( ./src/parse-gram.y )
[3] https://www.gnu.org/software/bison/manual/html_node/Invocation.html
TEST PLAN
I've been testing these changes the last week and I think it's ready.
REPOSITORY
R216 Syntax Highlighting
BRANCH
update-yacc-bison (branched from master)
REVISION DETAIL
https://phabricator.kde.org/D10783
AFFECTED FILES
autotests/folding/highlight.y.fold
autotests/html/highlight.y.html
autotests/input/highlight.y
autotests/reference/highlight.y.ref
data/syntax/yacc.xml
To: nibags
Cc: #frameworks, michaelh