Skip to content

Commit

Permalink
WIP: Nix lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed Sep 16, 2024
1 parent 5c32d4b commit 6f0bd1d
Show file tree
Hide file tree
Showing 14 changed files with 686 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ filetypes_dist = \
filedefs/filetypes.makefile \
filedefs/filetypes.markdown \
filedefs/filetypes.matlab \
filedefs/filetypes.nix \
filedefs/filetypes.Meson.conf \
filedefs/filetypes.Nim.conf \
filedefs/filetypes.nsis \
Expand Down
89 changes: 89 additions & 0 deletions data/filedefs/filetypes.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# For complete documentation of this file, please see Geany's main documentation
[styling]
# Edit these in the colorscheme .conf file instead

default=default
commentline=comment_line
commentblock=comment
string=string_1
stringmultiline=string_1
escapechar=regex
identifier=default
operator=operator
operatorstring=regex
number=number_1
key=tag
keyword1=keyword_1
keyword2=keyword_1
keyword3=keyword_2
keyword4=keyword_2
path=preprocessor

[keywords]
# all items must be in one line
keywords1=assert else if in inherit let or rec then with
keywords2=false null true
keywords3=abort add addDrvOutputDependencies all any attrNames attrValues baseNameOf bitAnd bitOr bitXor
break builtins catAttrs
ceil compareVersions concatLists concatMap concatStringsSep convertHash currentSystem currentTime
deepSeq derivation dirOf div elem
elemAt fetchClosure fetchGit fetchTarball fetchTree fetchurl filter filterSource findFile
flakeRefToString
floor foldl' fromJSON fromTOML functionArgs genList genericClosure getAttr getContext getEnv getFlake
groupBy hasAttr hasContext hashFile hashString head import intersectAttrs isAttrs isBool isFloat
isFunction isInt isList isNull isPath isString langVersion
length lessThan listToAttrs map mapAttrs match mul nixPath nixVersion
outputOf parseDrvName parseFlakeRef partition path pathExists placeholder readDir readFile
readFileType removeAttrs replaceStrings seq sort split splitVersion storeDir storePath stringLength sub
substring tail throw toFile toJSON toPath toString toXML trace traceVerbose tryEval typeOf
unsafeDiscardOutputDependency unsafeDiscardStringContext warn zipAttrsWith
keywords4=

[lexer_properties]

[settings]
# default extension used when saving files
extension=nix

# MIME type
mime_type=text/x-nix

# these characters define word boundaries when making selections and searching
# using word matching options
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

# single comment char, like # in this file
comment_single=#
# multiline comments
#comment_open=/*
#comment_close=*/

# set to false if a comment character/string should start at column 0 of a line, true uses any
# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
# #command_example();
# setting to false would generate this
# # command_example();
# This setting works only for single line comments
comment_use_indent=true

# context action command (please see Geany's main documentation for details)
context_action_cmd=

[indentation]
#width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
#type=0

[build-menu]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
FT_00_LB=_Compile
FT_00_CM=python -m py_compile "%f"
FT_00_WD=
FT_02_LB=_Lint
FT_02_CM=pycodestyle --max-line-length=80 "%f"
FT_02_WD=
error_regex=(.+):([0-9]+):([0-9]+)
EX_00_LB=_Execute
EX_00_CM=python "%f"
EX_00_WD=
1 change: 1 addition & 0 deletions data/filetype_extensions.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Markdown=*.mdml;*.markdown;*.md;*.mkd;*.mkdn;*.mdwn;*.mdown;*.mdtxt;*.mdtext;
Matlab/Octave=*.m;
Meson=meson.build;meson.options;meson_options.txt;
Nim=*.nim;
Nix=*.nix;
NSIS=*.nsi;*.nsh;
Objective-C=*.m;*.mm;*.h;
Pascal=*.pas;*.pp;*.inc;*.dpr;*.dpk;*.lpr;
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ lexilla = static_library('lexilla',
'scintilla/lexilla/lexers/LexMake.cxx',
'scintilla/lexilla/lexers/LexMarkdown.cxx',
'scintilla/lexilla/lexers/LexMatlab.cxx',
'scintilla/lexilla/lexers/LexNix.cxx',
'scintilla/lexilla/lexers/LexNsis.cxx',
'scintilla/lexilla/lexers/LexNull.cxx',
'scintilla/lexilla/lexers/LexPascal.cxx',
Expand Down
1 change: 1 addition & 0 deletions scintilla/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ lexilla/lexers/LexLua.cxx \
lexilla/lexers/LexMake.cxx \
lexilla/lexers/LexMarkdown.cxx \
lexilla/lexers/LexMatlab.cxx \
lexilla/lexers/LexNix.cxx \
lexilla/lexers/LexNsis.cxx \
lexilla/lexers/LexNull.cxx \
lexilla/lexers/LexPascal.cxx \
Expand Down
18 changes: 18 additions & 0 deletions scintilla/lexilla/include/SciLexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@

/* SciLexer features - not in standard Scintilla */

#define SCE_NIX_DEFAULT 0
#define SCE_NIX_COMMENTLINE 1
#define SCE_NIX_COMMENTBLOCK 2
#define SCE_NIX_STRING 3
#define SCE_NIX_STRING_MULTILINE 4
#define SCE_NIX_ESCAPECHAR 5
#define SCE_NIX_IDENTIFIER 6
#define SCE_NIX_OPERATOR 8
#define SCE_NIX_OPERATOR_STRING 9
#define SCE_NIX_NUMBER 10
#define SCE_NIX_KEY 11
#define SCE_NIX_KEYWORD1 12
#define SCE_NIX_KEYWORD2 13
#define SCE_NIX_KEYWORD3 14
#define SCE_NIX_KEYWORD4 15
#define SCE_NIX_PATH 16

/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
#define SCLEX_CONTAINER 0
#define SCLEX_NULL 1
Expand Down Expand Up @@ -148,6 +165,7 @@
#define SCLEX_JULIA 133
#define SCLEX_ASCIIDOC 134
#define SCLEX_GDSCRIPT 135
#define SCLEX_NIX 136
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
Expand Down
Loading

0 comments on commit 6f0bd1d

Please sign in to comment.