
org.textmapper.tool.templates.js.ltp Maven / Gradle / Ivy
The newest version!
${template main-}
${file opts.module+'.js'-}
${call js.header-}
(function() {
var root = this;
var ${opts.module} = { DEBUG_SYNTAX: false };
${call js_lexer.unit-}
${if parser-}
${call js_parser.unit-}
${end-}
root.${opts.module} = ${opts.module};
}).call(this);
${end-}
${end}
${template parserAction-}
${eval getAction()}
${end}
${query symText(property) =
self.rightOffset == -1
? (property == 'value' ? 'null' : '-1')
: (self.isLeft ? 'tmLeft' : 'this.tmStack[this.tmHead' + (self.rightOffset > 0 ? ' - ' + self.rightOffset : '') + ']')
+ '.' + property }
${template symAccess(property)-}
${assert ['value', 'line', 'column', 'offset', 'endline', 'endcolumn', 'endoffset'].contains(property)-}
${self->symText(property)-}
${end}
${query escapeJsReserved() =
[
'__proto__', 'undefined', 'null', 'true', 'false',
'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var',
'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while',
'debugger', 'function', 'this', 'with', 'default', 'if', 'throw',
'delete', 'in', 'try',
'class', 'enum', 'extends', 'super', 'const', 'export', 'import',
'implements', 'let', 'private', 'public', 'yield', 'interface',
'package', 'protected', 'static'
].contains(self) ? '_' + self : self }
${template header-}
${if opts.genCopyright && syntax.copyrightHeader-}
${foreach line in util.shiftRightWithSpaces(syntax.copyrightHeader, 1).split('\n')-}
// ${line}
${end-}
${else-}
// generated by Textmapper
${end-}
${end}
${query err_location(symvar,lexervar) = self->util.location(', ' + symvar + '.', '', '')}
${template err_location_safe(symvar,lexervar)-}
${foreach l in self->util.locationList()-}
, ${symvar} == null ? ${lexervar}.get${util.toFirstUpper(l.startsWith('end') ? l.substring(3) : l)}() : ${symvar}.${l}${end-}
${end}
${template classcode-}
${end}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy