summary refs log tree commit diff stats
path: root/ide/config.nim
diff options
context:
space:
mode:
Diffstat (limited to 'ide/config.nim')
-rw-r--r--ide/config.nim93
1 files changed, 93 insertions, 0 deletions
diff --git a/ide/config.nim b/ide/config.nim
new file mode 100644
index 000000000..448a67bda
--- /dev/null
+++ b/ide/config.nim
@@ -0,0 +1,93 @@
+# Does the config parsing for us

+

+import 

+  parsecfg, strtabs, strutils

+  

+type

+  TTokenClass* = enum

+    gtBackground,

+    gtNone,

+    gtWhitespace,

+    gtDecNumber,

+    gtBinNumber,

+    gtHexNumber,

+    gtOctNumber,

+    gtFloatNumber,

+    gtIdentifier,

+    gtKeyword,

+    gtStringLit,

+    gtLongStringLit,

+    gtCharLit,

+    gtEscapeSequence,

+    gtOperator,

+    gtPunctation,

+    gtComment,

+    gtLongComment,

+    gtRegularExpression,

+    gtTagStart,

+    gtTagEnd,

+    gtKey,

+    gtValue,

+    gtRawData,

+    gtAssembler,

+    gtPreprocessor,

+    gtDirective,

+    gtCommand,

+    gtRule,

+    gtHyperlink,

+    gtLabel,

+    gtReference,

+    gtOther,

+    gtCursor

+

+  TColor* = colKeywords, colIdentifiers, colComments

+  TConfiguration* = object of TObject       ## the configuration object

+    colors*: array [TTokenClass] of TColor  ## the colors to use

+    filelist*: seq[string]                  ## the filelist

+  

+const

+  colWhite = 0x00ffffff # rgb

+  colBlack = 0x00000000

+  colYellow = 

+  

+proc readConfig(filename: string): TConfiguration = 

+  # fill with reasonable defaults:

+  result.filelist = []

+  result.colors[gtBackground] = colWhite

+     gtNone: 

+    gtWhitespace,

+    gtDecNumber,

+    gtBinNumber,

+    gtHexNumber,

+    gtOctNumber,

+    gtFloatNumber,

+    gtIdentifier,

+    gtKeyword,

+    gtStringLit,

+    gtLongStringLit,

+    gtCharLit,

+    gtEscapeSequence,

+    gtOperator,

+    gtPunctation,

+    gtComment,

+    gtLongComment,

+    gtRegularExpression,

+    gtTagStart,

+    gtTagEnd,

+    gtKey,

+    gtValue,

+    gtRawData,

+    gtAssembler,

+    gtPreprocessor,

+    gtDirective,

+    gtCommand,

+    gtRule,

+    gtHyperlink,

+    gtLabel,

+    gtReference,

+    gtOther

+    gtCursor

+  var

+    p: TCfgParser

+  if open(p, filename):

+