Skip to content

Commit

Permalink
fix bug in strength grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Reinstein committed May 1, 2019
1 parent 939ae8f commit ee6c5cf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
8 changes: 4 additions & 4 deletions dist/constraint-solver.cjs.js
Expand Up @@ -131,12 +131,12 @@ function peg$parse(input, options) {
peg$startRuleIndex = 0,
peg$consts = [function (statements) {
return statements;
}, function (expression) {
var s = typeof strength !== 'undefined' ? s : 'STRONG';
}, function (expression, strength) {
var s = strength.length ? strength[0].toUpperCase() : 'STRONG';
expression.strength = s;
return expression;
}, function (name) {
var s = typeof strength !== 'undefined' ? s : 'STRONG';
var s = typeof strength !== 'undefined' ? strength.toUpperCase() : 'STRONG';
return {
type: "EditableVariable",
name: name,
Expand Down Expand Up @@ -221,7 +221,7 @@ function peg$parse(input, options) {

return result;
}],
peg$bytecode = [peg$decode("%;//A#$;!0#*;!&/1$;//($8#: #!!)(#'#(\"'#&'#"), peg$decode("%;//x#;A/o$%$;%/&#0#*;%&&&#/,#;@/#$+\")(\"'#&'#.\" &\"/A$$;%0#*;%&/1$;(/($8%:!%!#)(%'#($'#(#'#(\"'#&'#.\xA1 &%;//\x97#;?/\x8E$$;%/&#0#*;%&&&#/x$;4/o$%$;%/&#0#*;%&&&#/,#;@/#$+\")(\"'#&'#.\" &\"/A$$;%0#*;%&/1$;(/($8':\"'!#)(''#(&'#(%'#($'#(#'#(\"'#&'#"), peg$decode("1\"\"5!7#"), peg$decode("4$\"\"5!7%.5 &2&\"\"6&7'.) &2(\"\"6(7)"), peg$decode(";#.) &4*\"\"5!7+"), peg$decode("<4-\"\"5!7.=.\" 7,"), peg$decode("4/\"\"5!70"), peg$decode("<22\"\"6273.M &24\"\"6475.A &26\"\"6677.5 &28\"\"6879.) &2:\"\"6:7;=.\" 71"), peg$decode("%;//2#2<\"\"6<7=/#$+\")(\"'#&'#.O &%;./,#;'/#$+\")(\"'#&'#.6 &%;//,#;)/#$+\")(\"'#&'#"), peg$decode("%<1\"\"5!7#=.##&&!&'#"), peg$decode("<;+.# &;-=.\" 7>"), peg$decode("%2?\"\"6?7@/\x8C#$%%<2A\"\"6A7B=.##&&!&'#/,#;\"/#$+\")(\"'#&'#0H*%%<2A\"\"6A7B=.##&&!&'#/,#;\"/#$+\")(\"'#&'#&/2$2A\"\"6A7B/#$+#)(#'#(\"'#&'#"), peg$decode("%2?\"\"6?7@/\x98#$%%<2A\"\"6A7B.# &;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#0N*%%<2A\"\"6A7B.# &;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#&/2$2A\"\"6A7B/#$+#)(#'#(\"'#&'#"), peg$decode("%2C\"\"6C7D/\x80#$%%<;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#0B*%%<;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#&/2$;&.# &;)/#$+#)(#'#(\"'#&'#"), peg$decode("$;%.) &;,.# &;-0/*;%.) &;,.# &;-&"), peg$decode("$;%.) &;'.# &;*0/*;%.) &;'.# &;*&"), peg$decode("%;2.# &;1/' 8!:E!! )"), peg$decode("%$4*\"\"5!7+/,#0)*4*\"\"5!7+&&&#/' 8!:F!! )"), peg$decode("%%;1/;#2G\"\"6G7H/,$;1/#$+#)(#'#(\"'#&'#/' 8!:I!! )"), peg$decode("%4J\"\"5!7K.\" &\"/E#$4*\"\"5!7+/,#0)*4*\"\"5!7+&&&#/#$+\")(\"'#&'#"), peg$decode("<%;5/' 8!:M!! )=.\" 7L"), peg$decode("<%;#/9#$;$0#*;$&/)$8\":N\"\"! )(\"'#&'#=.\" 7L"), peg$decode("%;4/' 8!:O!! ).h &;0.b &%2P\"\"6P7Q/R#;//I$;A/@$;//7$2R\"\"6R7S/($8%:T%!\")(%'#($'#(#'#(\"'#&'#"), peg$decode(";6.E &%;8/;#;//2$;7/)$8#:U#\"\" )(#'#(\"'#&'#"), peg$decode("2V\"\"6V7W.5 &2X\"\"6X7Y.) &2Z\"\"6Z7["), peg$decode("%;7/\x83#$%;//>#;:/5$;//,$;7/#$+$)($'#(#'#(\"'#&'#0H*%;//>#;:/5$;//,$;7/#$+$)($'#(#'#(\"'#&'#&/)$8\":\\\"\"! )(\"'#&'#"), peg$decode("2]\"\"6]7^.) &2_\"\"6_7`"), peg$decode("%;9/\x83#$%;//>#;</5$;//,$;9/#$+$)($'#(#'#(\"'#&'#0H*%;//>#;</5$;//,$;9/#$+$)($'#(#'#(\"'#&'#&/)$8\":a\"\"! )(\"'#&'#"), peg$decode("2V\"\"6V7W.) &2X\"\"6X7Y"), peg$decode("%;;/\x83#$%;//>#;>/5$;//,$;;/#$+$)($'#(#'#(\"'#&'#0H*%;//>#;>/5$;//,$;;/#$+$)($'#(#'#(\"'#&'#&/)$8\":b\"\"! )(\"'#&'#"), peg$decode("2c\"\"6c7d.A &2e\"\"6e7f.5 &2g\"\"6g7h.) &2i\"\"6i7j"), peg$decode("3k\"\"5(7l"), peg$decode("3m\"\"5(7n.A &3o\"\"5&7p.5 &3q\"\"5&7r.) &3s\"\"5$7t"), peg$decode("%;=/\x8F#$%;//D#2u\"\"6u7v/5$;//,$;=/#$+$)($'#(#'#(\"'#&'#0N*%;//D#2u\"\"6u7v/5$;//,$;=/#$+$)($'#(#'#(\"'#&'#&/)$8\":w\"\"! )(\"'#&'#")],
peg$bytecode = [peg$decode("%;//A#$;!0#*;!&/1$;//($8#: #!!)(#'#(\"'#&'#"), peg$decode("%;//k#;A/b$$;%0#*;%&/R$$;@0#*;@&/B$$;%0#*;%&/2$;(/)$8&:!&\"$\")(&'#(%'#($'#(#'#(\"'#&'#.\xA1 &%;//\x97#;?/\x8E$$;%/&#0#*;%&&&#/x$;4/o$%$;%/&#0#*;%&&&#/,#;@/#$+\")(\"'#&'#.\" &\"/A$$;%0#*;%&/1$;(/($8':\"'!#)(''#(&'#(%'#($'#(#'#(\"'#&'#"), peg$decode("1\"\"5!7#"), peg$decode("4$\"\"5!7%.5 &2&\"\"6&7'.) &2(\"\"6(7)"), peg$decode(";#.) &4*\"\"5!7+"), peg$decode("<4-\"\"5!7.=.\" 7,"), peg$decode("4/\"\"5!70"), peg$decode("<22\"\"6273.M &24\"\"6475.A &26\"\"6677.5 &28\"\"6879.) &2:\"\"6:7;=.\" 71"), peg$decode("%;//2#2<\"\"6<7=/#$+\")(\"'#&'#.O &%;./,#;'/#$+\")(\"'#&'#.6 &%;//,#;)/#$+\")(\"'#&'#"), peg$decode("%<1\"\"5!7#=.##&&!&'#"), peg$decode("<;+.# &;-=.\" 7>"), peg$decode("%2?\"\"6?7@/\x8C#$%%<2A\"\"6A7B=.##&&!&'#/,#;\"/#$+\")(\"'#&'#0H*%%<2A\"\"6A7B=.##&&!&'#/,#;\"/#$+\")(\"'#&'#&/2$2A\"\"6A7B/#$+#)(#'#(\"'#&'#"), peg$decode("%2?\"\"6?7@/\x98#$%%<2A\"\"6A7B.# &;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#0N*%%<2A\"\"6A7B.# &;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#&/2$2A\"\"6A7B/#$+#)(#'#(\"'#&'#"), peg$decode("%2C\"\"6C7D/\x80#$%%<;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#0B*%%<;&=.##&&!&'#/,#;\"/#$+\")(\"'#&'#&/2$;&.# &;)/#$+#)(#'#(\"'#&'#"), peg$decode("$;%.) &;,.# &;-0/*;%.) &;,.# &;-&"), peg$decode("$;%.) &;'.# &;*0/*;%.) &;'.# &;*&"), peg$decode("%;2.# &;1/' 8!:E!! )"), peg$decode("%$4*\"\"5!7+/,#0)*4*\"\"5!7+&&&#/' 8!:F!! )"), peg$decode("%%;1/;#2G\"\"6G7H/,$;1/#$+#)(#'#(\"'#&'#/' 8!:I!! )"), peg$decode("%4J\"\"5!7K.\" &\"/E#$4*\"\"5!7+/,#0)*4*\"\"5!7+&&&#/#$+\")(\"'#&'#"), peg$decode("<%;5/' 8!:M!! )=.\" 7L"), peg$decode("<%;#/9#$;$0#*;$&/)$8\":N\"\"! )(\"'#&'#=.\" 7L"), peg$decode("%;4/' 8!:O!! ).h &;0.b &%2P\"\"6P7Q/R#;//I$;A/@$;//7$2R\"\"6R7S/($8%:T%!\")(%'#($'#(#'#(\"'#&'#"), peg$decode(";6.E &%;8/;#;//2$;7/)$8#:U#\"\" )(#'#(\"'#&'#"), peg$decode("2V\"\"6V7W.5 &2X\"\"6X7Y.) &2Z\"\"6Z7["), peg$decode("%;7/\x83#$%;//>#;:/5$;//,$;7/#$+$)($'#(#'#(\"'#&'#0H*%;//>#;:/5$;//,$;7/#$+$)($'#(#'#(\"'#&'#&/)$8\":\\\"\"! )(\"'#&'#"), peg$decode("2]\"\"6]7^.) &2_\"\"6_7`"), peg$decode("%;9/\x83#$%;//>#;</5$;//,$;9/#$+$)($'#(#'#(\"'#&'#0H*%;//>#;</5$;//,$;9/#$+$)($'#(#'#(\"'#&'#&/)$8\":a\"\"! )(\"'#&'#"), peg$decode("2V\"\"6V7W.) &2X\"\"6X7Y"), peg$decode("%;;/\x83#$%;//>#;>/5$;//,$;;/#$+$)($'#(#'#(\"'#&'#0H*%;//>#;>/5$;//,$;;/#$+$)($'#(#'#(\"'#&'#&/)$8\":b\"\"! )(\"'#&'#"), peg$decode("2c\"\"6c7d.A &2e\"\"6e7f.5 &2g\"\"6g7h.) &2i\"\"6i7j"), peg$decode("3k\"\"5(7l"), peg$decode("3m\"\"5(7n.A &3o\"\"5&7p.5 &3q\"\"5&7r.) &3s\"\"5$7t"), peg$decode("%;=/\x8F#$%;//D#2u\"\"6u7v/5$;//,$;=/#$+$)($'#(#'#(\"'#&'#0N*%;//D#2u\"\"6u7v/5$;//,$;=/#$+$)($'#(#'#(\"'#&'#&/)$8\":w\"\"! )(\"'#&'#")],
peg$currPos = 0,
peg$savedPos = 0,
peg$posDetailsCache = [{
Expand Down
8 changes: 4 additions & 4 deletions dist/constraint-solver.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions grammar.pegjs
Expand Up @@ -5,12 +5,13 @@ start
= __ statements:(Statement*) __ { return statements; }

Statement
= __ expression:LinearExpression (WhiteSpace+ strength:Strength)? WhiteSpace* EOS {
const s = (typeof strength !== 'undefined') ? s : 'STRONG';
= __ expression:LinearExpression WhiteSpace* strength:Strength* WhiteSpace* EOS {
const s = (strength.length) ? strength[0].toUpperCase() : 'STRONG';
expression.strength = s; return expression;
}
}

/ __ Editable WhiteSpace+ name:Identifier (WhiteSpace+ strength:Strength)? WhiteSpace* EOS {
const s = (typeof strength !== 'undefined') ? s : 'STRONG';
const s = (typeof strength !== 'undefined') ? strength.toUpperCase() : 'STRONG';
return { type: "EditableVariable", name: name, strength: s };
}

Expand Down Expand Up @@ -176,10 +177,7 @@ Editable
= "EDITABLE"i

Strength
= "REQUIRED"i
/ "STRONG"i
/ "MEDIUM"i
/ "WEAK"i
= "REQUIRED"i / "STRONG"i / "MEDIUM"i / "WEAK"i

LinearExpression
= head:InequalityExpression
Expand All @@ -194,4 +192,4 @@ LinearExpression
};
}
return result;
}
}
10 changes: 5 additions & 5 deletions lib/grammar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -35,7 +35,7 @@
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^4.0.1",
"tap": "^12.5.3"
"tap": "^13.0.0"
},
"keywords": [
"cassowary",
Expand Down

0 comments on commit ee6c5cf

Please sign in to comment.