Skip to content

Commit

Permalink
Add standalone lexer and API list for Go 1.14, issue #145.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Jun 30, 2020
1 parent 6fbbd45 commit 4efdc1d
Show file tree
Hide file tree
Showing 17 changed files with 1,657 additions and 55 deletions.
1 change: 1 addition & 0 deletions build/CodeLite/Notepad2.project
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<File Name="../../scintilla/lexers/LexFortran.cxx"/>
<File Name="../../scintilla/lexers/LexFSharp.cxx"/>
<File Name="../../scintilla/lexers/LexGN.cxx"/>
<File Name="../../scintilla/lexers/LexGo.cxx"/>
<File Name="../../scintilla/lexers/LexGraphViz.cxx"/>
<File Name="../../scintilla/lexers/LexHTML.cxx"/>
<File Name="../../scintilla/lexers/LexInno.cxx"/>
Expand Down
1 change: 1 addition & 0 deletions build/VS2017/Notepad2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@
<ClCompile Include="..\..\scintilla\lexers\LexFortran.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexFSharp.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexGN.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexGo.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexGraphViz.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexHTML.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexInno.cxx" />
Expand Down
3 changes: 3 additions & 0 deletions build/VS2017/Notepad2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<ClCompile Include="..\..\scintilla\lexers\LexGN.cxx">
<Filter>Scintilla\lexers</Filter>
</ClCompile>
<ClCompile Include="..\..\scintilla\lexers\LexGo.cxx">
<Filter>Scintilla\lexers</Filter>
</ClCompile>
<ClCompile Include="..\..\scintilla\lexers\LexGraphViz.cxx">
<Filter>Scintilla\lexers</Filter>
</ClCompile>
Expand Down
Binary file modified doc/Notepad2 DarkTheme.ini
Binary file not shown.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Latest development builds (artifacts in Release configuration for each compiler
* Fortran
* GNU Fortran
* [GN Build](../master/tools/lang/GN.gn), up to GN 2019-03-13.
* Go
* [Go](../master/tools/lang/Go.go), up to Go 1.14.
* Gradle, [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#gradle)
* GraphViz Dot, [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#graphviz)
* blockdiag, seqdiag, actdiag and nwdiag
Expand Down
25 changes: 25 additions & 0 deletions scintilla/include/SciLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
#define SCLEX_WASM 213
#define SCLEX_TOML 214
#define SCLEX_GN 215
#define SCLEX_GO 216
#define SCLEX_AUTOMATIC 1000
#define SCE_PY_DEFAULT 0
#define SCE_PY_COMMENTLINE 1
Expand Down Expand Up @@ -982,4 +983,28 @@
#define SCE_GN_BUILTIN_VARIABLE 10
#define SCE_GN_BUILTIN_FUNCTION 11
#define SCE_GN_FUNCTION 12
#define SCE_GO_DEFAULT 0
#define SCE_GO_COMMENTLINE 1
#define SCE_GO_COMMENTBLOCK 2
#define SCE_GO_STRING 3
#define SCE_GO_CHARACTER 4
#define SCE_GO_ESCAPECHAR 5
#define SCE_GO_RAW_STRING 6
#define SCE_GO_NUMBER 7
#define SCE_GO_OPERATOR 8
#define SCE_GO_OPERATOR2 9
#define SCE_GO_LABEL 10
#define SCE_GO_IDENTIFIER 11
#define SCE_GO_WORD 12
#define SCE_GO_WORD2 13
#define SCE_GO_BUILTIN_FUNC 14
#define SCE_GO_TYPE 15
#define SCE_GO_STRUCT 16
#define SCE_GO_INTERFACE 17
#define SCE_GO_CONSTANT 18
#define SCE_GO_FUNCTION 19
#define SCE_GO_FUNCTION_DEFINE 20
#define SCE_GO_FORMAT_SPECIFIER 21
#define SCE_GO_TASK_MARKER 22
#define SCE_GO_TASK_MARKER_LINE 23
/* --Autogenerated -- end of section automatically generated from SciLexer.iface */
27 changes: 27 additions & 0 deletions scintilla/include/SciLexer.iface
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ val SCLEX_JULIA=212
val SCLEX_WASM=213
val SCLEX_TOML=214
val SCLEX_GN=215
val SCLEX_GO=216

# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
Expand Down Expand Up @@ -2559,3 +2560,29 @@ val SCE_GN_KEYWORD=9
val SCE_GN_BUILTIN_VARIABLE=10
val SCE_GN_BUILTIN_FUNCTION=11
val SCE_GN_FUNCTION=12
# Lexical states for SCLEX_GO
lex Go=SCLEX_GO SCE_GO_
val SCE_GO_DEFAULT=0
val SCE_GO_COMMENTLINE=1
val SCE_GO_COMMENTBLOCK=2
val SCE_GO_STRING=3
val SCE_GO_CHARACTER=4
val SCE_GO_ESCAPECHAR=5
val SCE_GO_RAW_STRING=6
val SCE_GO_NUMBER=7
val SCE_GO_OPERATOR=8
val SCE_GO_OPERATOR2=9
val SCE_GO_LABEL=10
val SCE_GO_IDENTIFIER=11
val SCE_GO_WORD=12
val SCE_GO_WORD2=13
val SCE_GO_BUILTIN_FUNC=14
val SCE_GO_TYPE=15
val SCE_GO_STRUCT=16
val SCE_GO_INTERFACE=17
val SCE_GO_CONSTANT=18
val SCE_GO_FUNCTION=19
val SCE_GO_FUNCTION_DEFINE=20
val SCE_GO_FORMAT_SPECIFIER=21
val SCE_GO_TASK_MARKER=22
val SCE_GO_TASK_MARKER_LINE=23
8 changes: 3 additions & 5 deletions scintilla/lexers/LexCPP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ using namespace Scintilla;
#define LEX_HX 12 // haXe
#define LEX_GROOVY 13 // Groovy Script
#define LEX_SCALA 14 // Scala Script
#define LEX_GO 15 // Go
//#define LEX_AIDL 27 // Android Interface Definition Language
#define LEX_PHP 29
#define LEX_AWK 51 // Awk
Expand Down Expand Up @@ -647,7 +646,7 @@ static void ColouriseCppDoc(Sci_PositionU startPos, Sci_Position length, int ini
}
break;
case SCE_C_DSTRINGB: // D
if (sc.ch == '`' && (lexType == LEX_JS || lexType == LEX_D || lexType == LEX_GO)) {
if (sc.ch == '`' && (lexType == LEX_JS || lexType == LEX_D)) {
if (lexType == LEX_D && IsDStrFix(sc.chNext))
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
Expand Down Expand Up @@ -873,7 +872,7 @@ static void ColouriseCppDoc(Sci_PositionU startPos, Sci_Position length, int ini
++numDTSBrace;
sc.SetState(SCE_C_DSTRINGT);
sc.Forward();
} else if (sc.ch == '`' && (lexType == LEX_JS || lexType == LEX_D || lexType == LEX_GO)) {
} else if (sc.ch == '`' && (lexType == LEX_JS || lexType == LEX_D)) {
sc.SetState(SCE_C_DSTRINGB);
} else if (!SharpComment(lexType) && sc.Match('/', '*')) {
if (visibleChars == 0 && (sc.Match("/**") || sc.Match("/*!"))) {
Expand Down Expand Up @@ -1373,8 +1372,7 @@ static void FoldCppDoc(Sci_PositionU startPos, Sci_Position length, int initStyl
}
}

// Go
if ((lexType == LEX_JS || lexType == LEX_GO) && style == SCE_C_DSTRINGB) {
if (lexType == LEX_JS && style == SCE_C_DSTRINGB) {
if (ch == '`') {
if (styleNext == SCE_C_DSTRINGB)
levelNext++;
Expand Down

0 comments on commit 4efdc1d

Please sign in to comment.