ln.lexer/SharpLexer
Harald Wolff 44c2c89de0 Initial Commit 2018-03-07 21:05:21 +01:00
..
buffer Initial Commit 2018-03-07 21:05:21 +01:00
match Initial Commit 2018-03-07 21:05:21 +01:00
Fundamentals.xml Initial Commit 2018-03-07 21:05:21 +01:00
Grammar.cs Initial Commit 2018-03-07 21:05:21 +01:00
Lexer.cs Initial Commit 2018-03-07 21:05:21 +01:00
MainClass.cs Initial Commit 2018-03-07 21:05:21 +01:00
README.md Initial Commit 2018-03-07 21:05:21 +01:00
SharpLexer.csproj Initial Commit 2018-03-07 21:05:21 +01:00
TestGrammar.xml Initial Commit 2018-03-07 21:05:21 +01:00

README.md

Lexing Classes for .NET / Mono

Regular Expression Language used for definition of tokens:

  • Whitespace is ignored

  • '' is used as escape marker within character lists

  • [] define a character list for matching a) [a..z] match every character from 'a' to 'z' (included) b) [g] match character 'g' c) [egt] match one of the given characters // INVALID: d) characters may be defined by the character itself (e.g: H), by numerical value (e.g.: 32 or 0x20) e) [a..i/d..f] matches characters 'a' to 'i' but excludes characters 'd' to 'f' from matching f) [a.z] matches characters 'a','.' and 'z' g) [abcijkx..] matches characters 'a','b','c','i','j','k' and every character from 'x' to highest char (0xFFFF)

  • (...) define a group that is matched at whole

  • | define an alternative matching path, e.g. [.] | [,] matches a "." or a ",", but only one character each time matching happens

  • {} defines a repeated match for the prepended expression: a) "" or "{}" or "{1}" match exactly one time b) {3,} match at least 3 times to infinite times c) {1,3} match 1 to 3 times c) {,3} match 0 to 3 times

  • every other word consisting of the characters 0..9,a..z,A..Z is considered reference to another named expression

examples:

a numeric literal may be defined by:

[-]{0..1} [1..9] [0..9]{0..} ( [.] [0..9]{1..} ){0..1}

a possible string literal:

nonwhitespace: [33..]

string: ["] ( nonwhitespace | ([\] ["]) ) ["]


[-]{0..1} digit19 digit{0..} ( [.] digit{1..} ){0..1}

[-]{0..1} <= Expression [-] <= Matchable

digit19{1..1} <= Expression digit19 <= Matchable

Matchable: A singleton matchable object (a token or charactergroup) Expression: Combine a Matchable with an interval definition