ConstraintNetwork
Advanced tools
Comparing version 0.1.0 to 0.1.2
@@ -119,3 +119,3 @@ | ||
}); | ||
var IdentifierParser = jp.repeat1(jp.choice(jp.range('a', 'z'), jp.ch('_'))); | ||
var IdentifierParser = jp.repeat1(jp.choice(jp.range('a', 'z'), jp.ch('_'), jp.range("A", "Z"))); | ||
var OutputIdentifier = | ||
@@ -170,4 +170,6 @@ jp.action(IdentifierParser, function(ast) { | ||
); | ||
var result = Eq(jp.ps(str)).ast; | ||
var parsed = Eq(jp.ps(str)); | ||
var result = parsed.ast; | ||
console.log(str); | ||
console.log(parsed); | ||
result.inputs = inputs; | ||
@@ -174,0 +176,0 @@ console.log(result) |
@@ -14,3 +14,4 @@ var should =require("should"); | ||
"a = 2 * c + b ": ["a", ["c", "b"], new cn.Equation.Expression(new cn.Equation.Expression(new cn.Equation.Literal(2), new cn.Equation.Lookup("c"), "*"), new cn.Equation.Lookup("b"), "+")], | ||
"a = (1 + 2) * 3": ["a", [], new cn.Equation.Expression(new cn.Equation.Expression(new cn.Equation.Literal(1), new cn.Equation.Literal(2), "+"), new cn.Equation.Literal(3), "*")] | ||
"a = (1 + 2) * 3": ["a", [], new cn.Equation.Expression(new cn.Equation.Expression(new cn.Equation.Literal(1), new cn.Equation.Literal(2), "+"), new cn.Equation.Literal(3), "*")], | ||
"a = b + (c * d)": ["a", ["b", "c", "d"], new cn.Equation.Expression(new cn.Equation.Lookup("b"), new cn.Equation.Expression(new cn.Equation.Lookup("c"), new cn.Equation.Lookup("d"), "*"), "+")] | ||
} | ||
@@ -35,3 +36,10 @@ | ||
["transitive property", ["a=b", "b=c"], {c:10}, {a:10,b:10,c:10}], | ||
["solve for some", ["a=b+5","b=12","c=d * 20"], {}, {a:17,b:12}] | ||
["solve for some", ["a=b+5","b=12","c=d * 20"], {}, {a:17,b:12}], | ||
[ "simple bug from LoLEngine", [ | ||
"Health = ChampionHealth + (Level * ChampionHealthPerLevel)" | ||
], | ||
{ChampionHealth: 100, Level: 1, ChampionHealthPerLevel: 10}, | ||
{Health:110, ChampionHealth: 100, Level: 1, ChampionHealthPerLevel: 10} | ||
], | ||
] | ||
@@ -38,0 +46,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A constraint network library (think spreadsheet-style logic)", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "url": "" |
9679
4
244