> Assuming you are creating some universal lexer that uses e.g. some grammars
> for lexing. Then, instead of having tons of keywords from different languages
> in a single (fake) filetype for this lexer, it would be better to use this
> lexer for one filetype only, and define all other filetypes as external,
Exactly, that is, how I realised it:
Having one file, called `filetypes.Uni`. But this file is almost empty (just
one comment, which say, it is a dummy file). Then for each of wanted lexing
(let's say for Gcode files) one customer filetype file (in that case
filetypes.gcode.conf) is generated, having the line `lexer_filetype=Uni` in it
beside all keylist and style definitions.
To give you an impression, why so much keyword lists are necessary:
For universal lexer, you can not define, what char includes strings or
comments. So you must provide a keylist for each of them:
`StringDelimiter="`
or
`StringDelimiter='`
or even
`StringDelimiter=' "`
Same for comments:
C-like
`CommentMultilineStart=/*`
`CommentMultilineEnd=*/`
Pascal-like
`CommentMultilineStart={`
`CommentMultilineEnd=}`
Forth like:
`CommentMultilineStart=( `
`CommentMultilineEnd= )`
For instance in markdown files, if you want to style each level of headline (#
## ### ####), you need to have a separate keyword list and style for each level.
Currently LexUni does support 64 customer keylists and styles beside bulit in
lists (like `StringDelimiter`, `CommentMultilineStart`, `HexNumber`, ..).
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/discussions/4154#discussioncomment-11629148
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/repo-discussions/4154/comments/[email protected]>