author | Tom Tromey <tom@tromey.com> | 2019年06月01日 17:11:11 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019年06月01日 17:11:11 -0600 |
commit | fe7746aab74f21368e29cc1720bfd42c1307a579 (patch) | |
tree | dfc4bced0a530ddf7f0223d7c01425875233dacc /src | |
parent | 5078ca4cbc279970f0478e19d78ed8c8818a63a9 (diff) | |
download | src-highlite-fe7746aab74f21368e29cc1720bfd42c1307a579.tar.gz |
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/c.lang | 15 | ||||
-rw-r--r-- | src/c_preprocessor.lang | 9 | ||||
-rw-r--r-- | src/cpp.lang | 45 | ||||
-rw-r--r-- | src/d.lang | 25 |
diff --git a/src/Makefile.am b/src/Makefile.am index c8b7181..4131c0d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -86,7 +86,8 @@ vbscript.lang awk.lang bat.lang clipper.lang cobol.lang d.lang \ errors.lang erlang.lang proto.lang vala.lang lisp.lang islisp.lang \ scheme.lang po.lang opa.lang javalog.lang upc.lang tml.lang \ lilypond.lang coffeescript.lang go.lang \ -r.lang s.lang zsh.lang groovy.lang json.lang feature.lang rust.lang +r.lang s.lang zsh.lang groovy.lang json.lang feature.lang rust.lang \ +c_preprocessor.lang LANGFILES_NOTTOCHECK= \ tml_formatting_all.lang tml_macrolinks.lang tml_macrosdelayed2.lang \ @@ -1,4 +1,5 @@ # definitions for C + include "c_comment.lang" label = '^[[:blank:]]*[[:alnum:]]+:[[:blank:]]*\z' @@ -6,13 +7,7 @@ label = '^[[:blank:]]*[[:alnum:]]+:[[:blank:]]*\z' (keyword,normal,classname) = `(\<(?:enum|struct|union))([[:blank:]]+)([[:alnum:]_]+)` -state preproc start '^[[:blank:]]*#(?:[[:blank:]]*include)' begin - string delim "<" ">" - string delim "\"" "\"" escape "\\" - include "c_comment.lang" -end - -preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' +include "c_preprocessor.lang" include "number.lang" @@ -23,16 +18,18 @@ keyword = "__asm|__cdecl|__declspec|__export|__far16", "__pascal|__rtti|__stdcall|_asm|_cdecl", "__except|_export|_far16|_fastcall", "__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto", + "_Alignas|_Alignof|_Atomic|_Generic|_Noreturn|_Static_assert|_Thread_local", "break|case|catch|cdecl|const|continue|default", "do|else|enum|extern|for|goto", "if|pascal", - "register|return|sizeof|static", + "register|restrict|return|sizeof|static", "struct|switch", "typedef|union", "volatile|while" type = "bool|char|double|float|int|long", - "short|signed|unsigned|void|wchar_t" + "short|signed|unsigned|void|wchar_t", + "_Bool|_Complex|_Imaginary" include "symbols.lang" diff --git a/src/c_preprocessor.lang b/src/c_preprocessor.lang new file mode 100644 index 0000000..f0e801e --- /dev/null +++ b/src/c_preprocessor.lang @@ -0,0 +1,9 @@ +# C preprocessor. + +state preproc start '^[[:blank:]]*#(?:[[:blank:]]*include)' begin + string delim "<" ">" + string delim "\"" "\"" escape "\\" + include "c_comment.lang" +end + +preproc = '^[[:blank:]]*#([[:blank:]]*[[:word:]]*)' diff --git a/src/cpp.lang b/src/cpp.lang index 81fe3d1..480a393 100644 --- a/src/cpp.lang +++ b/src/cpp.lang @@ -1,15 +1,46 @@ # definitions for C++ -# most of it is shared with c.lang + +include "c_comment.lang" (keyword,normal,classname) = `(\<(?:enum|class|struct|typename|union))([[:blank:]]+)([[:alnum:]_]+)` -keyword = "class|const_cast|delete", - "dynamic_cast|explicit|false|friend", - "inline|mutable|namespace|new|operator|private|protected", - "public|reinterpret_cast|static_cast", - "template|this|throw|true", +include "c_preprocessor.lang" + +include "number.lang" + +include "c_string.lang" + +keyword = "__asm|__cdecl|__declspec|__export|__far16", + "__fastcall|__fortran|__import", + "__pascal|__rtti|__stdcall|_asm|_cdecl", + "__except|_export|_far16|_fastcall", + "__finally|_fortran|_import|_pascal|_stdcall|__thread|__try|asm|auto", + "break|case|cdecl|const|continue|default", + "do|else|enum|extern|for|goto", + "if|pascal", + "register|restrict|return|sizeof|static", + "struct|switch", + "typedef|union", + "volatile|while", + "catch|class|const_cast|constexpr|decltype|delete", + "dynamic_cast|explicit|export|false|final|friend", + "inline|mutable|namespace|new|noexcept|operator|override", + "private|protected|public|reinterpret_cast|static_cast", + "static_assert|template|this|throw|true", "try|typeid|typename", "using|virtual" -include "c.lang" +label = '^[[:blank:]]*[[:alnum:]]+:[[:blank:]]*\z' + +type = "bool|char|double|float|int|long", + "short|signed|unsigned|void|wchar_t", + "char16_t|char32_t" + +include "symbols.lang" + +cbracket = "{|}" + +include "function.lang" + +include "clike_vardeclaration.lang" @@ -1,5 +1,4 @@ # D language definition, http://www.digitalmars.com/d/2.0/index.html -# most is reused from cpp.lang preproc = '\<__[[:alpha:]]+__\>' preproc = "import" @@ -20,12 +19,21 @@ string delim "`" "`" # string literal postfix characters string = '\".*\"(c|w|d)' -include "cpp.lang" +include "c_comment.lang" + +(keyword,normal,classname) = + `(\<(?:enum|class|struct|typename|union))([[:blank:]]+)([[:alnum:]_]+)` type = "byte|cdouble|cent|cfloat|creal|dchar|idouble|ifloat|ireal", - "real|ubyte|ucent|uint|ulong|ushort|wchar" + "real|ubyte|ucent|uint|ulong|ushort|wchar", + "bool|char|double|float|int|long", + "short|signed|unsigned|wchar_t" + +include "number.lang" -subst keyword = "abstract|alias|align|asm|assert|auto|body", +include "c_string.lang" + +keyword = "abstract|alias|align|asm|assert|auto|body", "break|case|cast|catch|class|const|continue|debug|default", "delegate|delete|deprecated|do|else|enum|export|extern", "false|final|finally|for|foreach_reverse|foreach|function", @@ -37,3 +45,12 @@ subst keyword = "abstract|alias|align|asm|assert|auto|body", "typeof|union|unittest|version|void|volatile", "while|with|__gshared|__thread|__traits" +label = '^[[:blank:]]*[[:alnum:]]+:[[:blank:]]*\z' + +include "symbols.lang" + +cbracket = "{|}" + +include "function.lang" + +include "clike_vardeclaration.lang" |