This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AST = function() {}; | |
AST.prototype.init = function() { | |
this.p = {}; | |
}; | |
AST.prototype.walk = function(callback) { | |
callback.call(this); | |
var p = this.p; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tokens = {}; | |
tokens.ADD = /^[+-]/; | |
tokens.MUL = /^[*/%]/; | |
tokens.NUMBER = /^[0-9]+(\.[0-9]+)?/; | |
// --------------------------------------------------------------------------------------------------------------- // | |
var rules = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>parser.01</title> | |
<script src="01.parser.js"></script> | |
</head> | |
<body> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(data) { | |
var s = ''; | |
s += '<div class="hello">'; | |
s += 'Hello, ' + data.username; | |
s += '</div>'; | |
return s; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"settings": { | |
"foo": "low", | |
"bar": "high", | |
"baz": "low" | |
}, | |
"values": [ "low", "high" ] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --------------------------------------------------------------------------------------------------------------- // | |
var fs_ = require('fs'); | |
var path_ = require('path'); | |
// --------------------------------------------------------------------------------------------------------------- // | |
var basedir = path_.dirname(module.parent.filename); | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<func:function name="child-node"> | |
<xsl:param name="elements"/> | |
<xsl:variable name="nodes"> | |
<xsl:element name="{name()}"> | |
<xsl:for-each select="str:tokenize($elements, ',| ')"> | |
<xsl:element name="{normalize-space(.)}"/> | |
</xsl:for-each> | |
</xsl:element> | |
</xsl:variable> | |
<func:result select="exsl:node-set($nodes)/*/*"/> |
NewerOlder