summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hornsey <fred@hornsey.us>2021-05-02 01:46:19 -0500
committerGitHub <noreply@github.com>2021-05-02 08:46:19 +0200
commit7f85893012a0a94c03fc275d3621ee9c24d35d6f (patch)
tree5c6c10dfc91856407e996eddaca1fb2693c71d43
parentf0b806fb480cd1e121b67409b8eae96f3e0dfa53 (diff)
downloadpygments-git-7f85893012a0a94c03fc275d3621ee9c24d35d6f.tar.gz
Support for OMG IDL (#1595)
* Support for OMG IDL Lexer for [Object Management Group Interface Definition Language](https://www.omg.org/spec/IDL/About-IDL/). * Allow Whitespace Before include in C Preprocessor It wasn't highlighting the included filename the same as if there was no space before the include, but now it is. * Update omg-idl Tests to Latest Requirements * Update omg-idl versionadded to 2.9 Since I just realized this missed the 2.8 release. * Add Missing Operators to omg-idl
-rw-r--r--AUTHORS1
-rw-r--r--doc/languages.rst1
-rw-r--r--pygments/lexers/_mapping.py1
-rw-r--r--pygments/lexers/c_cpp.py6
-rw-r--r--pygments/lexers/c_like.py98
-rw-r--r--tests/examplefiles/omg-idl/example.idl86
-rw-r--r--tests/examplefiles/omg-idl/example.idl.output733
-rw-r--r--tests/snippets/c/test_preproc_file.txt8
-rw-r--r--tests/snippets/c/test_preproc_file2.txt8
-rw-r--r--tests/snippets/omg-idl/annotation_named_params.txt27
-rw-r--r--tests/snippets/omg-idl/enumerators.txt18
11 files changed, 983 insertions, 4 deletions
diff --git a/AUTHORS b/AUTHORS
index 6c028f3f..e8df1858 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -97,6 +97,7 @@ Other contributors, listed alphabetically, are:
* Doug Hogan -- Mscgen lexer
* Ben Hollis -- Mason lexer
* Max Horn -- GAP lexer
+* Fred Hornsey -- OMG IDL Lexer
* Alastair Houghton -- Lexer inheritance facility
* Tim Howard -- BlitzMax lexer
* Dustin Howett -- Logos lexer
diff --git a/doc/languages.rst b/doc/languages.rst
index 468a9f2f..86fde61e 100644
--- a/doc/languages.rst
+++ b/doc/languages.rst
@@ -260,6 +260,7 @@ Other markup
* `Nix language <https://nixos.org/nix/>`_
* NSIS scripts
* Notmuch
+* `OMG IDL <https://www.omg.org/spec/IDL/About-IDL/>`_
* `PEG <https://bford.info/packrat/>`_
* POV-Ray scenes
* `PromQL <https://prometheus.io/docs/prometheus/latest/querying/basics/>`_
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 647ae6f5..2f355ad2 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -330,6 +330,7 @@ LEXERS = {
'OcamlLexer': ('pygments.lexers.ml', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)),
'OctaveLexer': ('pygments.lexers.matlab', 'Octave', ('octave',), ('*.m',), ('text/octave',)),
'OdinLexer': ('pygments.lexers.archetype', 'ODIN', ('odin',), ('*.odin',), ('text/odin',)),
+ 'OmgIdlLexer': ('pygments.lexers.c_like', 'OMG Interface Definition Language', ('omg-idl',), ('*.idl', '*.pidl'), ()),
'OocLexer': ('pygments.lexers.ooc', 'Ooc', ('ooc',), ('*.ooc',), ('text/x-ooc',)),
'OpaLexer': ('pygments.lexers.ml', 'Opa', ('opa',), ('*.opa',), ('text/x-opa',)),
'OpenEdgeLexer': ('pygments.lexers.business', 'OpenEdge ABL', ('openedge', 'abl', 'progress'), ('*.p', '*.cls'), ('text/x-openedge', 'application/x-openedge')),
diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py
index 32c29e5f..059b9be3 100644
--- a/pygments/lexers/c_cpp.py
+++ b/pygments/lexers/c_cpp.py
@@ -153,8 +153,10 @@ class CFamilyLexer(RegexLexer):
(r'\\', String), # stray backslash
],
'macro': [
- (r'(include)('+_ws1+r')("[^"]+")([^\n]*)', bygroups(Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)),
- (r'(include)('+_ws1+r')(<[^>]+>)([^\n]*)', bygroups(Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)),
+ (r'('+_ws1+r')(include)('+_ws1+r')("[^"]+")([^\n]*)',
+ bygroups(using(this), Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)),
+ (r'('+_ws1+r')(include)('+_ws1+r')(<[^>]+>)([^\n]*)',
+ bygroups(using(this), Comment.Preproc, using(this), Comment.PreprocFile, Comment.Single)),
(r'[^/\n]+', Comment.Preproc),
(r'/[*](.|\n)*?[*]/', Comment.Multiline),
(r'//.*?\n', Comment.Single, '#pop'),
diff --git a/pygments/lexers/c_like.py b/pygments/lexers/c_like.py
index c5989fe0..39967832 100644
--- a/pygments/lexers/c_like.py
+++ b/pygments/lexers/c_like.py
@@ -13,13 +13,14 @@ import re
from pygments.lexer import RegexLexer, include, bygroups, inherit, words, \
default
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
- Number, Punctuation
+ Number, Punctuation, Whitespace
from pygments.lexers.c_cpp import CLexer, CppLexer
from pygments.lexers import _mql_builtins
__all__ = ['PikeLexer', 'NesCLexer', 'ClayLexer', 'ECLexer', 'ValaLexer',
- 'CudaLexer', 'SwigLexer', 'MqlLexer', 'ArduinoLexer', 'CharmciLexer']
+ 'CudaLexer', 'SwigLexer', 'MqlLexer', 'ArduinoLexer', 'CharmciLexer',
+ 'OmgIdlLexer']
class PikeLexer(CppLexer):
@@ -568,3 +569,96 @@ class CharmciLexer(CppLexer):
inherit,
],
}
+
+
+class OmgIdlLexer(CLexer):
+ """
+ Lexer for `Object Management Group Interface Definition Language <https://www.omg.org/spec/IDL/About-IDL/>`_.
+
+ .. versionadded:: 2.9
+ """
+
+ name = 'OMG Interface Definition Language'
+ aliases = ['omg-idl']
+ filenames = ['*.idl', '*.pidl']
+ mimetypes = []
+
+ scoped_name = r'((::)?\w+)+'
+
+ tokens = {
+ 'values': [
+ (words(('true', 'false'), prefix=r'(?i)', suffix=r'\b'), Number),
+ (r'([Ll]?)(")', bygroups(String.Affix, String.Double), 'string'),
+ (r'([Ll]?)(\')(\\[^\']+)(\')',
+ bygroups(String.Affix, String.Char, String.Escape, String.Char)),
+ (r'([Ll]?)(\')(\\\')(\')',
+ bygroups(String.Affix, String.Char, String.Escape, String.Char)),
+ (r'([Ll]?)(\'.\')', bygroups(String.Affix, String.Char)),
+ (r'[+-]?\d+(\.\d*)?[Ee][+-]?\d+', Number.Float),
+ (r'[+-]?(\d+\.\d*)|(\d*\.\d+)([Ee][+-]?\d+)?', Number.Float),
+ (r'(?i)[+-]?0x[0-9a-f]+', Number.Hex),
+ (r'[+-]?[1-9]\d*', Number.Integer),
+ (r'[+-]?0[0-7]*', Number.Oct),
+ (r'[\+\-\*\/%^&\|~]', Operator),
+ (words(('<<', '>>')), Operator),
+ (scoped_name, Name),
+ (r'[{};:,<>\[\]]', Punctuation),
+ ],
+ 'annotation_params': [
+ include('whitespace'),
+ (r'\(', Punctuation, '#push'),
+ include('values'),
+ (r'=', Punctuation),
+ (r'\)', Punctuation, '#pop'),
+ ],
+ 'annotation_params_maybe': [
+ (r'\(', Punctuation, 'annotation_params'),
+ include('whitespace'),
+ default('#pop'),
+ ],
+ 'annotation_appl': [
+ (r'@' + scoped_name, Name.Decorator, 'annotation_params_maybe'),
+ ],
+ 'enum': [
+ include('whitespace'),
+ (r'[{,]', Punctuation),
+ (r'\w+', Name.Constant),
+ include('annotation_appl'),
+ (r'\}', Punctuation, '#pop'),
+ ],
+ 'root': [
+ include('whitespace'),
+ (words((
+ 'typedef', 'const',
+ 'in', 'out', 'inout', 'local',
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword.Declaration),
+ (words((
+ 'void', 'any', 'native', 'bitfield',
+ 'unsigned', 'boolean', 'char', 'wchar', 'octet', 'short', 'long',
+ 'int8', 'uint8', 'int16', 'int32', 'int64', 'uint16', 'uint32', 'uint64',
+ 'float', 'double', 'fixed',
+ 'sequence', 'string', 'wstring', 'map',
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword.Type),
+ (words((
+ '@annotation', 'struct', 'union', 'bitset', 'interface',
+ 'exception', 'valuetype', 'eventtype', 'component',
+ ), prefix=r'(?i)', suffix=r'(\s+)(\w+)'), bygroups(Keyword, Whitespace, Name.Class)),
+ (words((
+ 'abstract', 'alias', 'attribute', 'case', 'connector',
+ 'consumes', 'context', 'custom', 'default', 'emits', 'factory',
+ 'finder', 'getraises', 'home', 'import', 'manages', 'mirrorport',
+ 'multiple', 'Object', 'oneway', 'primarykey', 'private', 'port',
+ 'porttype', 'provides', 'public', 'publishes', 'raises',
+ 'readonly', 'setraises', 'supports', 'switch', 'truncatable',
+ 'typeid', 'typename', 'typeprefix', 'uses', 'ValueBase',
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword),
+ (r'(?i)(enum|bitmask)(\s+)(\w+)',
+ bygroups(Keyword, Whitespace, Name.Class), 'enum'),
+ (r'(?i)(module)(\s+)(\w+)',
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
+ (r'(\w+)(\s*)(=)', bygroups(Name.Constant, Whitespace, Operator)),
+ (r'[\(\)]', Punctuation),
+ include('values'),
+ include('annotation_appl'),
+ ],
+ }
diff --git a/tests/examplefiles/omg-idl/example.idl b/tests/examplefiles/omg-idl/example.idl
new file mode 100644
index 00000000..84e90df5
--- /dev/null
+++ b/tests/examplefiles/omg-idl/example.idl
@@ -0,0 +1,86 @@
+/*
+ * Comment
+ */
+
+/* Comment */
+
+// Comment
+
+#include "local.idl"
+#include <global.idl>
+
+#define MACRO "String that should not be highlighted"
+
+#ifdef MACRO
+# define something "String that should not be highlighted"
+# include "local.idl"
+# include <global.idl>
+#endif
+
+typedef long ArrayType[10];
+
+@annotation the_annotation {
+ unsigned long value default 10;
+};
+
+const unsigned long a = 10;
+const int8 b = -10;
+const uint16 c = 0x10af;
+const int32 d = -0X10AF;
+const long e = 01234;
+const double f = -102.34e+10;
+const double f2 = .34;
+const double f3 = 0.34;
+const double f4 = 102.34;
+const double f5 = 102e+4;
+const double f6 = .1e4;
+const boolean g = TRUE;
+const boolean h = FALSE;
+const char i = 'i';
+const char j = '\n';
+const char k = '\'';
+const string l = "Hello World\n\t\v\b\r\f\a\\\'\"\xff";
+const wchar m = L'i';
+const wchar n = L'\n';
+const wchar o = L'\'';
+const wstring p = L"Hello World\n\t\v\b\r\f\a\\\'\"\xff";
+
+const long expr = (4 * (2 + 6) / 2 - 7) % 6;
+const long expr2 = (~4 >> 8) << 2;
+
+const long id_with_number_4_in_it = 4;
+
+@topic
+struct the_struct {
+ @min(10) long x;
+ @key short t;
+ sequence<long> anon_seq;
+};
+
+module the_module {
+ const long value = 0x30;
+
+ @some_annotation
+ enum EnumType {
+ x_value,
+ @::mod::anno(1) y_value,
+ z_value
+ };
+};
+
+@some_annotation(x=1, y="Hello\n", z=z_value)
+@another_annotation(a=2, b="Goodbye\n", c=y_value)
+union the_union switch(@key long) {
+case 1:
+ short x;
+case 2:
+ long y;
+case 3:
+ float z;
+default:
+ char xyz;
+};
+
+local interface the_interface {
+ the_struct get_struct(in long in_arg, inout long inout_arg, out long out_arg);
+};
diff --git a/tests/examplefiles/omg-idl/example.idl.output b/tests/examplefiles/omg-idl/example.idl.output
new file mode 100644
index 00000000..d146330e
--- /dev/null
+++ b/tests/examplefiles/omg-idl/example.idl.output
@@ -0,0 +1,733 @@
+'/*\n * Comment\n */' Comment.Multiline
+'\n' Text
+
+'\n' Text
+
+'/* Comment */' Comment.Multiline
+'\n' Text
+
+'\n' Text
+
+'// Comment\n' Comment.Single
+
+'\n' Text
+
+'#' Comment.Preproc
+'include' Comment.Preproc
+' ' Text
+'"local.idl"' Comment.PreprocFile
+'\n' Comment.Preproc
+
+'#' Comment.Preproc
+'include' Comment.Preproc
+' ' Text
+'<global.idl>' Comment.PreprocFile
+'\n' Comment.Preproc
+
+'\n' Text
+
+'#' Comment.Preproc
+'define MACRO "String that should not be highlighted"' Comment.Preproc
+'\n' Comment.Preproc
+
+'\n' Text
+
+'#' Comment.Preproc
+'ifdef MACRO' Comment.Preproc
+'\n' Comment.Preproc
+
+'#' Comment.Preproc
+' define something "String that should not be highlighted"' Comment.Preproc
+'\n' Comment.Preproc
+
+'#' Comment.Preproc
+' ' Text
+'include' Comment.Preproc
+' ' Text
+'"local.idl"' Comment.PreprocFile
+'\n' Comment.Preproc
+
+'#' Comment.Preproc
+' ' Text
+'include' Comment.Preproc
+' ' Text
+'<global.idl>' Comment.PreprocFile
+'\n' Comment.Preproc
+
+'#' Comment.Preproc
+'endif' Comment.Preproc
+'\n' Comment.Preproc
+
+'\n' Text
+
+'typedef' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'ArrayType' Name
+'[' Punctuation
+'10' Literal.Number.Integer
+']' Punctuation
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'@annotation' Keyword
+' ' Text.Whitespace
+'the_annotation' Name.Class
+' ' Text
+'{' Punctuation
+'\n' Text
+
+' ' Text
+'unsigned' Keyword.Type
+' ' Text
+'long' Keyword.Type
+' ' Text
+'value' Name
+' ' Text
+'default' Keyword
+' ' Text
+'10' Literal.Number.Integer
+';' Punctuation
+'\n' Text
+
+'}' Punctuation
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'unsigned' Keyword.Type
+' ' Text
+'long' Keyword.Type
+' ' Text
+'a' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'10' Literal.Number.Integer
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'int8' Keyword.Type
+' ' Text
+'b' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'-10' Literal.Number.Integer
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'uint16' Keyword.Type
+' ' Text
+'c' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'0x10af' Literal.Number.Hex
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'int32' Keyword.Type
+' ' Text
+'d' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'-0X10AF' Literal.Number.Hex
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'e' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'01234' Literal.Number.Oct
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'double' Keyword.Type
+' ' Text
+'f' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'-102.34e+10' Literal.Number.Float
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'double' Keyword.Type
+' ' Text
+'f2' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'.34' Literal.Number.Float
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'double' Keyword.Type
+' ' Text
+'f3' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'0.34' Literal.Number.Float
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'double' Keyword.Type
+' ' Text
+'f4' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'102.34' Literal.Number.Float
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'double' Keyword.Type
+' ' Text
+'f5' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'102e+4' Literal.Number.Float
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'double' Keyword.Type
+' ' Text
+'f6' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'.1e4' Literal.Number.Float
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'boolean' Keyword.Type
+' ' Text
+'g' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'TRUE' Literal.Number
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'boolean' Keyword.Type
+' ' Text
+'h' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'FALSE' Literal.Number
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'char' Keyword.Type
+' ' Text
+'i' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+"'i'" Literal.String.Char
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'char' Keyword.Type
+' ' Text
+'j' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+"'" Literal.String.Char
+'\\n' Literal.String.Escape
+"'" Literal.String.Char
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'char' Keyword.Type
+' ' Text
+'k' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+"'" Literal.String.Char
+"\\'" Literal.String.Escape
+"'" Literal.String.Char
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'string' Keyword.Type
+' ' Text
+'l' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'"' Literal.String.Double
+'Hello World' Literal.String
+'\\n' Literal.String.Escape
+'\\t' Literal.String.Escape
+'\\v' Literal.String.Escape
+'\\b' Literal.String.Escape
+'\\r' Literal.String.Escape
+'\\f' Literal.String.Escape
+'\\a' Literal.String.Escape
+'\\\\' Literal.String.Escape
+"\\'" Literal.String.Escape
+'\\"' Literal.String.Escape
+'\\xff' Literal.String.Escape
+'"' Literal.String
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'wchar' Keyword.Type
+' ' Text
+'m' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'L' Literal.String.Affix
+"'i'" Literal.String.Char
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'wchar' Keyword.Type
+' ' Text
+'n' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'L' Literal.String.Affix
+"'" Literal.String.Char
+'\\n' Literal.String.Escape
+"'" Literal.String.Char
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'wchar' Keyword.Type
+' ' Text
+'o' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'L' Literal.String.Affix
+"'" Literal.String.Char
+"\\'" Literal.String.Escape
+"'" Literal.String.Char
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'wstring' Keyword.Type
+' ' Text
+'p' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'L' Literal.String.Affix
+'"' Literal.String.Double
+'Hello World' Literal.String
+'\\n' Literal.String.Escape
+'\\t' Literal.String.Escape
+'\\v' Literal.String.Escape
+'\\b' Literal.String.Escape
+'\\r' Literal.String.Escape
+'\\f' Literal.String.Escape
+'\\a' Literal.String.Escape
+'\\\\' Literal.String.Escape
+"\\'" Literal.String.Escape
+'\\"' Literal.String.Escape
+'\\xff' Literal.String.Escape
+'"' Literal.String
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'expr' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'(' Punctuation
+'4' Literal.Number.Integer
+' ' Text
+'*' Operator
+' ' Text
+'(' Punctuation
+'2' Literal.Number.Integer
+' ' Text
+'+' Operator
+' ' Text
+'6' Literal.Number.Integer
+')' Punctuation
+' ' Text
+'/' Operator
+' ' Text
+'2' Literal.Number.Integer
+' ' Text
+'-' Operator
+' ' Text
+'7' Literal.Number.Integer
+')' Punctuation
+' ' Text
+'%' Operator
+' ' Text
+'6' Literal.Number.Integer
+';' Punctuation
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'expr2' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'(' Punctuation
+'~' Operator
+'4' Literal.Number.Integer
+' ' Text
+'>>' Operator
+' ' Text
+'8' Literal.Number.Integer
+')' Punctuation
+' ' Text
+'<<' Operator
+' ' Text
+'2' Literal.Number.Integer
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'const' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'id_with_number_4_in_it' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'4' Literal.Number.Integer
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'@topic' Name.Decorator
+'\n' Text
+
+'struct' Keyword
+' ' Text.Whitespace
+'the_struct' Name.Class
+' ' Text
+'{' Punctuation
+'\n' Text
+
+' ' Text
+'@min' Name.Decorator
+'(' Punctuation
+'10' Literal.Number.Integer
+')' Punctuation
+' ' Text
+'long' Keyword.Type
+' ' Text
+'x' Name
+';' Punctuation
+'\n' Text
+
+' ' Text
+'@key' Name.Decorator
+' ' Text
+'short' Keyword.Type
+' ' Text
+'t' Name
+';' Punctuation
+'\n' Text
+
+' ' Text
+'sequence' Keyword.Type
+'<' Punctuation
+'long' Keyword.Type
+'>' Punctuation
+' ' Text
+'anon_seq' Name
+';' Punctuation
+'\n' Text
+
+'}' Punctuation
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'module' Keyword.Namespace
+' ' Text.Whitespace
+'the_module' Name.Namespace
+' ' Text
+'{' Punctuation
+'\n' Text
+
+' ' Text
+'const' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'value' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'0x30' Literal.Number.Hex
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+' ' Text
+'@some_annotation' Name.Decorator
+'\n' Text
+
+' ' Text
+'enum' Keyword
+' ' Text.Whitespace
+'EnumType' Name.Class
+' ' Text
+'{' Punctuation
+'\n' Text
+
+' ' Text
+'x_value' Name.Constant
+',' Punctuation
+'\n' Text
+
+' ' Text
+'@::mod::anno' Name.Decorator
+'(' Punctuation
+'1' Literal.Number.Integer
+')' Punctuation
+' ' Text
+'y_value' Name.Constant
+',' Punctuation
+'\n' Text
+
+' ' Text
+'z_value' Name.Constant
+'\n' Text
+
+' ' Text
+'}' Punctuation
+';' Punctuation
+'\n' Text
+
+'}' Punctuation
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'@some_annotation' Name.Decorator
+'(' Punctuation
+'x' Name
+'=' Punctuation
+'1' Literal.Number.Integer
+',' Punctuation
+' ' Text
+'y' Name
+'=' Punctuation
+'"' Literal.String.Double
+'Hello' Literal.String
+'\\n' Literal.String.Escape
+'"' Literal.String
+',' Punctuation
+' ' Text
+'z' Name
+'=' Punctuation
+'z_value' Name
+')' Punctuation
+'\n' Text
+
+'@another_annotation' Name.Decorator
+'(' Punctuation
+'a' Name
+'=' Punctuation
+'2' Literal.Number.Integer
+',' Punctuation
+' ' Text
+'b' Name
+'=' Punctuation
+'"' Literal.String.Double
+'Goodbye' Literal.String
+'\\n' Literal.String.Escape
+'"' Literal.String
+',' Punctuation
+' ' Text
+'c' Name
+'=' Punctuation
+'y_value' Name
+')' Punctuation
+'\n' Text
+
+'union' Keyword
+' ' Text.Whitespace
+'the_union' Name.Class
+' ' Text
+'switch' Keyword
+'(' Punctuation
+'@key' Name.Decorator
+' ' Text
+'long' Keyword.Type
+')' Punctuation
+' ' Text
+'{' Punctuation
+'\n' Text
+
+'case' Keyword
+' ' Text
+'1' Literal.Number.Integer
+':' Punctuation
+'\n' Text
+
+' ' Text
+'short' Keyword.Type
+' ' Text
+'x' Name
+';' Punctuation
+'\n' Text
+
+'case' Keyword
+' ' Text
+'2' Literal.Number.Integer
+':' Punctuation
+'\n' Text
+
+' ' Text
+'long' Keyword.Type
+' ' Text
+'y' Name
+';' Punctuation
+'\n' Text
+
+'case' Keyword
+' ' Text
+'3' Literal.Number.Integer
+':' Punctuation
+'\n' Text
+
+' ' Text
+'float' Keyword.Type
+' ' Text
+'z' Name
+';' Punctuation
+'\n' Text
+
+'default' Keyword
+':' Punctuation
+'\n' Text
+
+' ' Text
+'char' Keyword.Type
+' ' Text
+'xyz' Name
+';' Punctuation
+'\n' Text
+
+'}' Punctuation
+';' Punctuation
+'\n' Text
+
+'\n' Text
+
+'local' Keyword.Declaration
+' ' Text
+'interface' Keyword
+' ' Text.Whitespace
+'the_interface' Name.Class
+' ' Text
+'{' Punctuation
+'\n' Text
+
+' ' Text
+'the_struct' Name
+' ' Text
+'get_struct' Name
+'(' Punctuation
+'in' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'in_arg' Name
+',' Punctuation
+' ' Text
+'inout' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'inout_arg' Name
+',' Punctuation
+' ' Text
+'out' Keyword.Declaration
+' ' Text
+'long' Keyword.Type
+' ' Text
+'out_arg' Name
+')' Punctuation
+';' Punctuation
+'\n' Text
+
+'}' Punctuation
+';' Punctuation
+'\n' Text
diff --git a/tests/snippets/c/test_preproc_file.txt b/tests/snippets/c/test_preproc_file.txt
index c00af1da..6454702c 100644
--- a/tests/snippets/c/test_preproc_file.txt
+++ b/tests/snippets/c/test_preproc_file.txt
@@ -1,5 +1,6 @@
---input---
#include <foo>
+# include <foo>
---tokens---
'#' Comment.Preproc
@@ -7,3 +8,10 @@
' ' Text
'<foo>' Comment.PreprocFile
'\n' Comment.Preproc
+
+'#' Comment.Preproc
+' ' Text
+'include' Comment.Preproc
+' ' Text
+'<foo>' Comment.PreprocFile
+'\n' Comment.Preproc
diff --git a/tests/snippets/c/test_preproc_file2.txt b/tests/snippets/c/test_preproc_file2.txt
index a0ce5a69..985ed749 100644
--- a/tests/snippets/c/test_preproc_file2.txt
+++ b/tests/snippets/c/test_preproc_file2.txt
@@ -1,5 +1,6 @@
---input---
#include "foo.h"
+# include "foo.h"
---tokens---
'#' Comment.Preproc
@@ -7,3 +8,10 @@
' ' Text
'"foo.h"' Comment.PreprocFile
'\n' Comment.Preproc
+
+'#' Comment.Preproc
+' ' Text
+'include' Comment.Preproc
+' ' Text
+'"foo.h"' Comment.PreprocFile
+'\n' Comment.Preproc
diff --git a/tests/snippets/omg-idl/annotation_named_params.txt b/tests/snippets/omg-idl/annotation_named_params.txt
new file mode 100644
index 00000000..d67e7bb4
--- /dev/null
+++ b/tests/snippets/omg-idl/annotation_named_params.txt
@@ -0,0 +1,27 @@
+Asserts that annotation named parameters use Name, which is different from the
+normal "scoped_name =" lexing, which uses Name.Constant.
+
+---input---
+@mod::anno(value = const_a) const short const_b = const_a;
+
+---tokens---
+'@mod::anno' Name.Decorator
+'(' Punctuation
+'value' Name
+' ' Text
+'=' Punctuation
+' ' Text
+'const_a' Name
+')' Punctuation
+' ' Text
+'const' Keyword.Declaration
+' ' Text
+'short' Keyword.Type
+' ' Text
+'const_b' Name.Constant
+' ' Text.Whitespace
+'=' Operator
+' ' Text
+'const_a' Name
+';' Punctuation
+'\n' Text
diff --git a/tests/snippets/omg-idl/enumerators.txt b/tests/snippets/omg-idl/enumerators.txt
new file mode 100644
index 00000000..c6986aba
--- /dev/null
+++ b/tests/snippets/omg-idl/enumerators.txt
@@ -0,0 +1,18 @@
+Asserts that enumerators use Name.Constant instead of just Name.
+
+---input---
+enum Enum_t {enum_a, enum_b};
+
+---tokens---
+'enum' Keyword
+' ' Text.Whitespace
+'Enum_t' Name.Class
+' ' Text
+'{' Punctuation
+'enum_a' Name.Constant
+',' Punctuation
+' ' Text
+'enum_b' Name.Constant
+'}' Punctuation
+';' Punctuation
+'\n' Text