MCPcopy Create free account
hub / github.com/TruthHun/BookStack / tokenizer

Function tokenizer

static/editor.md/lib/codemirror/mode/erlang/erlang.js:103–290  ·  view source on GitHub ↗
(stream,state)

Source from the content-addressed store, hash-verified

101// tokenizer
102
103 function tokenizer(stream,state) {
104 // in multi-line string
105 if (state.in_string) {
106 state.in_string = (!doubleQuote(stream));
107 return rval(state,stream,"string");
108 }
109
110 // in multi-line atom
111 if (state.in_atom) {
112 state.in_atom = (!singleQuote(stream));
113 return rval(state,stream,"atom");
114 }
115
116 // whitespace
117 if (stream.eatSpace()) {
118 return rval(state,stream,"whitespace");
119 }
120
121 // attributes and type specs
122 if (!peekToken(state) &&
123 stream.match(/-\s*[a-zß-öø-ÿ][\wØ-ÞÀ-Öß-öø-ÿ]*/)) {
124 if (is_member(stream.current(),typeWords)) {
125 return rval(state,stream,"type");
126 }else{
127 return rval(state,stream,"attribute");
128 }
129 }
130
131 var ch = stream.next();
132
133 // comment
134 if (ch == '%') {
135 stream.skipToEnd();
136 return rval(state,stream,"comment");
137 }
138
139 // colon
140 if (ch == ":") {
141 return rval(state,stream,"colon");
142 }
143
144 // macro
145 if (ch == '?') {
146 stream.eatSpace();
147 stream.eatWhile(anumRE);
148 return rval(state,stream,"macro");
149 }
150
151 // record
152 if (ch == "#") {
153 stream.eatSpace();
154 stream.eatWhile(anumRE);
155 return rval(state,stream,"record");
156 }
157
158 // dollar escape
159 if (ch == "$") {
160 if (stream.next() == "\\" && !stream.match(escapesRE)) {

Callers 1

erlang.jsFile · 0.85

Calls 8

doubleQuoteFunction · 0.85
rvalFunction · 0.85
singleQuoteFunction · 0.85
peekTokenFunction · 0.85
is_memberFunction · 0.85
lookaheadFunction · 0.85
nongreedyFunction · 0.85
greedyFunction · 0.85

Tested by

no test coverage detected