blob: dcad7353cd01ad67309df929ec3b6e140daee09e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
'use strict'
var asciiPunctuation = require('../character/ascii-punctuation.js')
var characterEscape = {
name: 'characterEscape',
tokenize: tokenizeCharacterEscape
}
function tokenizeCharacterEscape(effects, ok, nok) {
return start
function start(code) {
effects.enter('characterEscape')
effects.enter('escapeMarker')
effects.consume(code)
effects.exit('escapeMarker')
return open
}
function open(code) {
if (asciiPunctuation(code)) {
effects.enter('characterEscapeValue')
effects.consume(code)
effects.exit('characterEscapeValue')
effects.exit('characterEscape')
return ok
}
return nok(code)
}
}
module.exports = characterEscape
|