Skip to content

Commit

Permalink
Support OCaml, issue #24.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Jul 5, 2023
1 parent 946d3d3 commit bf3297a
Show file tree
Hide file tree
Showing 18 changed files with 571 additions and 24 deletions.
2 changes: 2 additions & 0 deletions build/CodeLite/Notepad2.project
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<File Name="../../scintilla/lexers/LexNim.cxx"/>
<File Name="../../scintilla/lexers/LexNSIS.cxx"/>
<File Name="../../scintilla/lexers/LexNull.cxx"/>
<File Name="../../scintilla/lexers/LexOCaml.cxx"/>
<File Name="../../scintilla/lexers/LexPascal.cxx"/>
<File Name="../../scintilla/lexers/LexPerl.cxx"/>
<File Name="../../scintilla/lexers/LexPHP.cxx"/>
Expand Down Expand Up @@ -241,6 +242,7 @@
<File Name="../../src/EditLexers/stlMATLAB.c"/>
<File Name="../../src/EditLexers/stlNim.c"/>
<File Name="../../src/EditLexers/stlNsis.c"/>
<File Name="../../src/EditLexers/stlOCaml.c"/>
<File Name="../../src/EditLexers/stlPascal.c"/>
<File Name="../../src/EditLexers/stlPerl.c"/>
<File Name="../../src/EditLexers/stlPHP.c"/>
Expand Down
2 changes: 2 additions & 0 deletions build/VS2017/Notepad2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@
<ClCompile Include="..\..\scintilla\lexers\LexNim.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexNSIS.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexNull.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexOCaml.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexPascal.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexPerl.cxx" />
<ClCompile Include="..\..\scintilla\lexers\LexPHP.cxx" />
Expand Down Expand Up @@ -644,6 +645,7 @@
<ClCompile Include="..\..\src\EditLexers\stlMATLAB.c" />
<ClCompile Include="..\..\src\EditLexers\stlNsis.c" />
<ClCompile Include="..\..\src\EditLexers\stlNim.c" />
<ClCompile Include="..\..\src\EditLexers\stlOCaml.c" />
<ClCompile Include="..\..\src\EditLexers\stlPascal.c" />
<ClCompile Include="..\..\src\EditLexers\stlPerl.c" />
<ClCompile Include="..\..\src\EditLexers\stlPHP.c" />
Expand Down
6 changes: 6 additions & 0 deletions build/VS2017/Notepad2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
<ClCompile Include="..\..\scintilla\lexers\LexNull.cxx">
<Filter>Scintilla\lexers</Filter>
</ClCompile>
<ClCompile Include="..\..\scintilla\lexers\LexOCaml.cxx">
<Filter>Scintilla\lexers</Filter>
</ClCompile>
<ClCompile Include="..\..\scintilla\lexers\LexPascal.cxx">
<Filter>Scintilla\lexers</Filter>
</ClCompile>
Expand Down Expand Up @@ -540,6 +543,9 @@
<ClCompile Include="..\..\src\EditLexers\stlNsis.c">
<Filter>Source Files\EditLexers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\EditLexers\stlOCaml.c">
<Filter>Source Files\EditLexers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\EditLexers\stlPascal.c">
<Filter>Source Files\EditLexers</Filter>
</ClCompile>
Expand Down
9 changes: 6 additions & 3 deletions doc/Notepad2 DarkTheme.ini
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@ Operator=fore:#A349A4
Variable=fore:#0080FF
Operator=fore:#A349A4
Target=fore:#0080FF; back:#FFC000
[Mathematica]
Number=fore:#F84C4C
Operator=fore:#A349A4
[Markdown]
Horizontal Rule=bold; back:#404030; eolfilled
Block Quote=fore:#A46000; back:#424640; eolfilled
Expand All @@ -291,6 +288,9 @@ Inline Math=back:#303030
Delimiter Row=bold; back:#404030; eolfilled
Line Addition=back:#085820
Line Removal=back:#A52A2A
[Mathematica]
Number=fore:#F84C4C
Operator=fore:#A349A4
[MATLAB Code]
Keyword=fore:#00B050
Basic Function=fore:#8E0D90
Expand All @@ -305,6 +305,9 @@ Keyword=fore:#00B050
Number=fore:#F84C4C
Operator=fore:#A349A4
Label=back:#404030
[OCaml Source]
Number=fore:#F84C4C
Operator=fore:#A349A4
[Pascal Source]
Preprocessor=fore:#8E0D90
Number=fore:#F84C4C
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Latest development builds (artifacts in Release configuration for each compiler
* Gnuplot
* [Nim Script](tools/lang/Nim.nim), up to Nim 1.6.
* [Nullsoft Scriptable Install System](tools/lang/NSIS.nsi), up to NSIS 3.09.
* [OCaml](tools/lang/OCaml.ml), up to OCaml 5.0.
* Pascal, Delphi
* [Perl](tools/lang/Perl.pl), up to Perl 5.36. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#perl)
* [PowerShell](tools/lang/PowerShell.ps1), up to PowerShell 7.2.
Expand Down
16 changes: 16 additions & 0 deletions scintilla/include/SciLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#define SCLEX_APDL 61
#define SCLEX_BASH 62
#define SCLEX_VHDL 64
#define SCLEX_OCAML 65
#define SCLEX_PHPSCRIPT 69
#define SCLEX_REBOL 71
#define SCLEX_INNOSETUP 76
Expand Down Expand Up @@ -797,6 +798,21 @@
#define SCE_VHDL_FUNCTION_DEFINITION 23
#define SCE_VHDL_FUNCTION 24
#define SCE_VHDL_LABEL 25
#define SCE_OCAML_DEFAULT 0
#define SCE_OCAML_COMMENT 1
#define SCE_OCAML_IDENTIFIER 2
#define SCE_OCAML_TAGNAME 3
#define SCE_OCAML_ATTRIBUTE 4
#define SCE_OCAML_OPERATOR 5
#define SCE_OCAML_NUMBER 6
#define SCE_OCAML_CHARACTER 7
#define SCE_OCAML_STRING 8
#define SCE_OCAML_QUOTED_STRING 9
#define SCE_OCAML_QUOTED_STRINGID 10
#define SCE_OCAML_ESCAPECHAR 11
#define SCE_OCAML_FORMAT_SPECIFIER 12
#define SCE_OCAML_KEYWORD 13
#define SCE_OCAML_TYPE 14
#define SCE_REBOL_DEFAULT 0
#define SCE_REBOL_COMMENTLINE 1
#define SCE_REBOL_COMMENTBLOCK 2
Expand Down
37 changes: 18 additions & 19 deletions scintilla/include/SciLexer.iface
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ val SCLEX_APDL=61
val SCLEX_BASH=62
#val SCLEX_ASN1=63
val SCLEX_VHDL=64
#val SCLEX_CAML=65
val SCLEX_OCAML=65
#val SCLEX_BLITZBASIC=66
#val SCLEX_PUREBASIC=67
#val SCLEX_HASKELL=68
Expand Down Expand Up @@ -1421,24 +1421,23 @@ val SCE_VHDL_CONSTANT=
val SCE_VHDL_FUNCTION_DEFINITION=
val SCE_VHDL_FUNCTION=
val SCE_VHDL_LABEL=
# Lexical states for SCLEX_CAML
#lex Caml=SCLEX_CAML SCE_CAML_
#val SCE_CAML_DEFAULT=0
#val SCE_CAML_IDENTIFIER=1
#val SCE_CAML_TAGNAME=2
#val SCE_CAML_KEYWORD=3
#val SCE_CAML_KEYWORD2=4
#val SCE_CAML_KEYWORD3=5
#val SCE_CAML_LINENUM=6
#val SCE_CAML_OPERATOR=7
#val SCE_CAML_NUMBER=8
#val SCE_CAML_CHAR=9
#val SCE_CAML_WHITE=10
#val SCE_CAML_STRING=11
#val SCE_CAML_COMMENT=12
#val SCE_CAML_COMMENT1=13
#val SCE_CAML_COMMENT2=14
#val SCE_CAML_COMMENT3=15
# Lexical states for SCLEX_OCAML
lex OCaml=SCLEX_OCAML SCE_OCAML_
val SCE_OCAML_DEFAULT=
val SCE_OCAML_COMMENT=
val SCE_OCAML_IDENTIFIER=
val SCE_OCAML_TAGNAME=
val SCE_OCAML_ATTRIBUTE=
val SCE_OCAML_OPERATOR=
val SCE_OCAML_NUMBER=
val SCE_OCAML_CHARACTER=
val SCE_OCAML_STRING=
val SCE_OCAML_QUOTED_STRING=
val SCE_OCAML_QUOTED_STRINGID=
val SCE_OCAML_ESCAPECHAR=
val SCE_OCAML_FORMAT_SPECIFIER=
val SCE_OCAML_KEYWORD=
val SCE_OCAML_TYPE=
# Lexical states for SCLEX_HASKELL
#lex Haskell=SCLEX_HASKELL SCE_HA_
#val SCE_HA_DEFAULT=0
Expand Down
2 changes: 1 addition & 1 deletion scintilla/lexers/LexMathematica.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void ColouriseMathematicaDoc(Sci_PositionU startPos, Sci_Position lengthDoc, int
if (sc.state == SCE_MATHEMATICA_IDENTIFIER) {
char s[128];
sc.GetCurrent(s, sizeof(s));
if (keywordLists[0].InList(s)) {
if (keywordLists[KeywordIndex_Keyword].InList(s)) {
sc.ChangeState(SCE_MATHEMATICA_KEYWORD);
}
sc.SetState(SCE_MATHEMATICA_DEFAULT);
Expand Down
Loading

0 comments on commit bf3297a

Please sign in to comment.