The patch is taken from:
https://github.com/zyedidia/micro/pull/2738
The mentioned file was already removed with the following commit:
fe3186ba9d
The `micro` binary itself takes now care of validating the syntax definitions
and informs about possible issues.
Different assemblers have different syntaxes for comments: ";", "#",
"!", "|", "@", "*" and finally C-like comments "//" and "/* ... */".
Micro currently highlights only ";". This is causing various problems
with broken highlighting with other types of comments (i.e. those not
recognized by micro as comments), when the text in those comments
contains special characters, causing wrong highlighting of text after
them.
On the other hand, highlighting comments like "#", "|" etc would cause
conflicts with other syntax elements, e.g. constants in ARM assembly,
preprocessor directives, arithmetic expressions etc.
So let's highlight at least C-like comments. They are quite commonly
used and they are not so likely to cause conflicts with other syntax
elements.
In rust, there are some prefixes that may be part of the string literal.
String literals of the form b"test" (and br##"test"## etc) are byte
strings (as opposed to unicode strings), and similarly, string literals
of the form c"test" are C zero-terminated strings. Hence, added optional
prefixes to each of the string regular expressions so the prefix will be
recognized as part of the string.
Built and tested after fix.
Co-authored-by: James Corey <jc-git@neniam.net>
Update from PR feedback:
Coalesce multiple statement rules into one.
Coalesce multiple constant.number into one.
Update from more PR feedback:
Fix special variables (starting with $)--var must start with $,
i.e. x$y is not a valid special var, but you can have x=$y.
Compiled and tested again with latest changes.
Co-authored-by: James Corey <jc-git@neniam.net>
* parser: Precise error message for missing `start` & `end` in region
* parser: Check and prompt for empty patterns and region properties
* syntax: Remove empty identifier pattern from log definition
Support crontab filetype detection in the case crontab is opened via
sudoedit. Also apparently this fixes crontab filetype detection when
it is opened normally via `crontab -e` but in MacOS.
Fixes#3172
This typo causes a funny bug: the autodetected filetype for *.jsonnet
files is an empty string instead of "jsonnet".
Even funnier, when autocompleting "set filetype " (with the fix from
PR #3218), the first suggested filetype is this empty string.
Turning `header` patterns into `signature` patterns in all syntax files
was a mistake. The two are different things. In almost all syntax files
those patterns are things like shebangs or <?xml ... ?> or
<!DOCTYPE html5> i.e. things that:
1. can be (and should be) used for detecting the filetype when there is
no `filename` match (and that is actually the purpose of those
patterns, so it's a regression that it doesn't work anymore).
2. should only occur in the first line of the file, not in the first
100 lines or so.
In other words, the old `header` semantics was exactly what was needed
for those filetypes, while the new `signature` semantics makes little
sense for them.
So replace `signature` back with `header` in most syntax files. Keep
`signature` only in C++ and Objective-C syntax files, for which it was
actually introduced.
Replacing header patterns with signature patterns was a mistake, since
both have their own uses. So restore support for header regex, while
keeping support for signature regex as well.
* Update C syntax with keywords up to C23.
* Update C syntax with some GCC extensions.
* Update C# syntax with new keywords up to C# 12.
* Update C# syntax with preprocessor directives.
* Add Cake build script (C#) syntax.
* Add MSBuild (XML) syntax.