code / bp

Lines4.3K C3.3K Markdown541 YAML273 make110 Shell77 Lua54
(27 lines)
1 # Syntax definition for some C++-specific patterns
2 #
3 # NOTE: this is *NOT* intended to be a complete definition of the language's
4 # syntax! Providing a full language grammar is overkill, because the intended
5 # use case is finding/replacing string patterns. This task does not require a
6 # full parse tree, and having one makes the task considerably more complicated.
7 # See the accompanying README.md for more info.
9 comment: "//" .. $ / "/*" ..%\n "*/"
10 string: `" ..%string-escape `"
11 keyword: ("alignas" / "alignof" / "and" / "and_eq" / "asm" / "atomic_cancel" / "atomic_commit" /
12 "atomic_noexcept" / "auto" / "bitand" / "bitor" / "bool" / "break" / "case" / "catch" /
13 "char" / "char8_t" / "char16_t" / "char32_t" / "class" / "compl" / "concept" / "const" /
14 "consteval" / "constexpr" / "constinit" / "const_cast" / "continue" / "co_await" /
15 "co_return" / "co_yield" / "decltype" / "default" / "delete" / "do" / "double" /
16 "dynamic_cast" / "else" / "enum" / "explicit" / "export" / "extern" / "false" / "float" /
17 "for" / "friend" / "goto" / "if" / "inline" / "int" / "long" / "mutable" / "namespace" /
18 "new" / "noexcept" / "not" / "not_eq" / "nullptr" / "operator" / "or" / "or_eq" /
19 "private" / "protected" / "public" / "reflexpr" / "register" / "reinterpret_cast" /
20 "requires" / "return" / "short" / "signed" / "sizeof" / "static" / "static_assert" /
21 "static_cast" / "struct" / "switch" / "synchronized" / "template" / "this" /
22 "thread_local" / "throw" / "true" / "try" / "typedef" / "typeid" / "typename" / "union" /
23 "unsigned" / "using" / "virtual" / "void" / "volatile" / "wchar_t" / "while" / "xor" / "xor_eq")
24 function-def: ^_ 2+(id / keyword / anglebraces / `*) % __ parens (__`; / >(__`{))
25 function: function-def __ braces
26 macro: ^"#define"| ..$ *(<`\ \n..$)
27 import: ^`#("include"/"import")| __ (string / `<..`>)