Added troff/nroff lexer#264
Added troff/nroff lexer#264rhaberkorn wants to merge 2 commits intoScintillaOrg:masterfrom rhaberkorn:troff
Conversation
|
I will look at this after 5.4.0 is released in a few days. |
|
There are some shadowed variables which produces warnings. Shadowed variables can make it easier for maintainers to add new bugs so its best to rename either the inner or outer variables. This is best done by the original author as they are more likely to see problems in behaviour. This log is from Visual C++ Code Analysis and similar results are produced by cppcheck. |
Among many other things, this allows lexing of manpage source documents. The lexer is macro-package agnostic, though. Lexer restrictions are documented in LexTroff.cxx.
|
cppcheck doesn't warn about anything by default for some strange reason. Even more strangely, adding Anyway, I refactored my code and also renamed a few variables, to conform to the camel case style of lexilla. The troff branch is rebased on top of master. |
Among many other things, this allows lexing of manpage source documents. The lexer is macro-package agnostic, though. Lexer restrictions are documented in LexTroff.cxx.
|
Squashed then committed with some minor changes. Changed header inclusion order to match |
The command line used (from the directory above |
|
Thank you! Will you add Troff support to the upcoming SciTE release? IMHO you can close this PR. |
|
The I couldn't find |
It's for the Memorandum Macros, a classic macro package. See Still, as Troff is generally little used nowadays, you should probably give precedence to Objective C++ and leave the Even the Groff repository contains only a single |
|
Added troff.properties to SciTE but to avoid long menus it is inactive until user enables it by changing https://sourceforge.net/p/scintilla/scite/ci/dcaf189779c4ab8408e40e0b98b61f44a1ffa02c/ |
|
Great, thanks! I will drop a note on the Groff mailing list once it gets into the next SciTE release. PS: Why did you remove all of the comments in troff.properties? |
That's the version embedded into the single file executable which doesn't have any comments since you can't read inside the executable and comments could muck up its slightly different format. I'd actually forgotten to add the main copy of |
Among many other things, this allows lexing of manpage source documents.
The lexer is macro-package agnostic, though. Troff is also used as a typesetting package.
This lexer goes further than most Troff lexers by actually trying to parse its syntax instead of only applying heuristics. Unfortunately, the language is strictly speaking unparseable even with intimate knowledge of the syntax of all of its requests as its parsing behavior often depends on runtime state (and we all know that the halting problem is undecidable). Any Troff lexer is therefore necessarily a compromise.
This implementation tries hard to guarantee at least the following:
\\) in string assignments and macro definitions. I am not sure if we can reliably predict where to resolve these indirections. (What does the bash lexer do in this case, anyway?)\{and\}).Currently there are the following restrictions:
.ccor.c2willnot affect lexing - subsequent requests will not be styled correctly.
Luckily this feature is rarely used.
However, the C lexer apparently has the same restriction.
.if) and after all presumed macro calls, ie. if the command is not a known request from the keywordlist.\\$1) cannot currentlybe highlighted, as it is impossible to predict the context in which an
expansion will be used. Perhaps we should add an exception at least for
\\$nas they are practically never used without escaping the backslash?.ami,.ami1,.deiand.dei1) cannot be folded.SciTECO already added support for this lexer..
Here's a proper SciTE properties file for supporting the Lexer.
It was only tested with SciTE 5.13, but I don't think that much has changed in the properties syntax. I can also send it to the Scintilla mailing list once this gets merged, unless @nyamatongwe just takes it from here.