Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/jadelet-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ ${input.slice(result.pos)}
generate: generate,
rules: rules
};
}, {"Template":["S",[["?","__"],["*","Line"]],{"f":"var top = a => a[a.length-1];\nfunction reduceLines(lines) {\n var depth = 0;\n var stack = [[]];\n var firstIndent = 0;\n lines.forEach( ([indent, line]) => {\n if (firstIndent === 0 && indent > depth + 1) {\n firstIndent = indent - 1;\n }\n indent = indent > firstIndent ? indent - firstIndent : indent;\n if (Array.isArray(line)) {\n line[1] = collectAttributes(line[1])\n }\n if (depth+1 === indent) {\n // We're adding to the content of the last element in the current stack\n stack.push(top(top(stack))[2])\n } else if ( indent > depth) {\n throw new Error(\"Indented too far\")\n } else if (indent < depth) {\n stack = stack.slice(0, indent + 1)\n }\n depth = indent\n top(stack).push(line)\n })\n return stack[0]\n}\nfunction collectAttributes(attributesArray) {\n return attributesArray.reduce((o, [key, value]) => {\n if (key === \"id\" || key === \"class\" || key === \"style\") {\n var p = o[key] || (o[key] = [])\n p.push(value)\n } else {\n o[key] = value\n }\n return o\n }, {})\n}\nfunction pretty(lines) {\n return lines.map(line =>\n JSON.stringify(line)\n )\n}\nvar reduced = reduceLines($2);\nif (reduced.length != 1) {\n throw new Error(\"Must have exactly one root node.\");\n}\nreturn reduced[0];"}],"Line":["S",["Indent","LineBody","EOS"],[1,2]],"LineBody":["/",[["S",["Tag",["?","DeprecatedEquals"],"_","RestOfLine"],{"f":"$1[2].push($4)\nreturn $1"}],["S",["Tag",["?","_"]],1],["S",[["L","|"],["?",["L"," "]],"RestOfLine"],{"f":"return $3 + \"\\n\";"}],["S",[["?",["S",["DeprecatedEquals","_"]]],"RestOfLine"],2]]],"RestOfLine":["R","[^\\n\\r]*",{"f":"// TODO: Handle runs of text with bound content inside\nif ($0.slice(0,1) === \"@\") {\n return {\n bind: $0.slice(1)\n }\n} else {\n return $0\n}"}],"DeprecatedEquals":["L","=",{"f":"console.warn(\"'= <content>' is deprecated, you can remove the '=' without issue.\")"}],"Tag":["/",[["S",["TagName","OptionalIds","OptionalClasses","OptionalAttributes"],{"f":"return [\n $1,\n $2.concat($3, $4),\n [],\n]"}],["S",["Ids","OptionalClasses","OptionalAttributes"],{"f":"return [\n \"div\",\n $1.concat($2, $3),\n [],\n]"}],["S",["Classes","OptionalAttributes"],{"f":"return [\n \"div\",\n $1.concat($2),\n [],\n]"}]]],"OptionalClasses":["/",["Classes",["L","",{"f":"return []"}]]],"Classes":["+","Class"],"Class":["/",[["S",[["L","."],"Identifier"],{"f":"return [\"class\", $2]"}],["S",[["L","."],["!","Identifier"]],{"f":"throw \"Expected a class name\""}],"IdError"]],"OptionalIds":["?","Ids",{"f":"return $1 || []"}],"Ids":["S",["Id"],{"f":"return [ $1 ]"}],"Id":["/",[["S",[["L","#"],"Identifier"],{"f":"return [\"id\", $2]"}],["S",[["L","#"],["!","Identifier"]],{"f":"throw \"Expected an id name\""}]]],"IdError":["L","#",{"f":"throw \"Ids must appear before classes and attributes. Elements can only have one id.\""}],"ClassError":["L",".",{"f":"throw \"Classes cannot appear after attributes.\""}],"TagName":"Identifier","OptionalAttributes":["/",[["S",[["L","("],["?","__"],["+","Attribute"],["L",")"],["?","IdError"],["?","ClassError"]],{"f":"return $3"}],["L","(",{"f":"throw \"Invalid attributes\""}],["L","",{"f":"return []"}]]],"Attribute":["/",[["S",["AtIdentifier",["?","__"]],{"f":"return [$1.bind, $1]"}],["S",["EqBinding",["?","__"]],1],["S",["Identifier",["?","__"]],{"f":"return [$1, \"\"]"}]]],"AtIdentifier":["S",[["L","@"],"Identifier"],{"f":"return {\n bind: $2\n}"}],"EqBinding":["S",["Identifier",["L","="],["/",["AtIdentifier","Value"]]],[1,3]],"Identifier":["R","[a-zA-Z][a-zA-Z0-9-]*"],"Indent":["*",["/",[["L"," "],["L","\\t"]]],{"f":"return $1.length"}],"_":["R","[ \\t]+"],"__":["+",["/",[["R","[ \\t]"],"EOL"]]],"Value":["/",[["S",[["L","\\\""],["*","DoubleStringCharacter"],["L","\\\""]],{"f":"return $2.join(\"\")"}],["S",[["L","'"],["*","SingleStringCharacter"],["L","'"]],{"f":"return $2.join(\"\")"}],"Number"]],"DoubleStringCharacter":["/",[["S",[["!",["/",[["L","\\\""],["L","\\\\"]]]],["R","."]],2],["S",[["L","\\\\"],"EscapeSequence"],2]]],"SingleStringCharacter":["/",[["S",[["!",["/",[["L","'"],["L","\\\\"]]]],["R","."]],2],["S",[["L","\\\\"],"EscapeSequence"],2]]],"EscapeSequence":["/",[["L","'"],["L","\\\""],["L","\\\\"],["R",".",{"f":"return \"\\\\\" + $0"}]]],"Number":["/",[["R","-?[0-9]+\\.[0-9]+"],["R","-?[0-9]+"]]],"EOS":["/",[["S",[["+",["S",[["?","_"],"EOL"]]],"_","EOF"]],["+",["S",[["?","_"],"EOL"]]],"EOF"]],"EOL":["/",[["L","\\r\\n"],["L","\\n"],["L","\\r"]]],"EOF":["!",["R","[\\s\\S]"]]}));
}, {"Template":["S",[["?","__"],["*","Line"]],{"f":"var top = a => a[a.length-1];\nfunction reduceLines(lines) {\n var depth = 0;\n var stack = [[]];\n var firstIndent = 0;\n lines.forEach( ([indent, line]) => {\n if (firstIndent === 0 && indent > depth + 1) {\n firstIndent = indent;\n indent = 1;\n }\n indent = indent > firstIndent ? indent - firstIndent : indent;\n if (Array.isArray(line)) {\n line[1] = collectAttributes(line[1])\n }\n if (depth+1 === indent) {\n // We're adding to the content of the last element in the current stack\n stack.push(top(top(stack))[2])\n } else if ( indent > depth) {\n throw new Error(\"Indented too far\")\n } else if (indent < depth) {\n stack = stack.slice(0, indent + 1)\n }\n depth = indent\n top(stack).push(line)\n })\n return stack[0]\n}\nfunction collectAttributes(attributesArray) {\n return attributesArray.reduce((o, [key, value]) => {\n if (key === \"id\" || key === \"class\" || key === \"style\") {\n var p = o[key] || (o[key] = [])\n p.push(value)\n } else {\n o[key] = value\n }\n return o\n }, {})\n}\nfunction pretty(lines) {\n return lines.map(line =>\n JSON.stringify(line)\n )\n}\nvar reduced = reduceLines($2);\nif (reduced.length != 1) {\n throw new Error(\"Must have exactly one root node.\");\n}\nreturn reduced[0];"}],"Line":["S",["Indent","LineBody","EOS"],[1,2]],"LineBody":["/",[["S",["Tag",["?","DeprecatedEquals"],"_","RestOfLine"],{"f":"$1[2].push($4)\nreturn $1"}],["S",["Tag",["?","_"]],1],["S",[["L","|"],["?",["L"," "]],"RestOfLine"],{"f":"return $3 + \"\\n\";"}],["S",[["?",["S",["DeprecatedEquals","_"]]],"RestOfLine"],2]]],"RestOfLine":["R","[^\\n\\r]*",{"f":"// TODO: Handle runs of text with bound content inside\nif ($0.slice(0,1) === \"@\") {\n return {\n bind: $0.slice(1)\n }\n} else {\n return $0\n}"}],"DeprecatedEquals":["L","=",{"f":"console.warn(\"'= <content>' is deprecated, you can remove the '=' without issue.\")"}],"Tag":["/",[["S",["TagName","OptionalIds","OptionalClasses","OptionalAttributes"],{"f":"return [\n $1,\n $2.concat($3, $4),\n [],\n]"}],["S",["Ids","OptionalClasses","OptionalAttributes"],{"f":"return [\n \"div\",\n $1.concat($2, $3),\n [],\n]"}],["S",["Classes","OptionalAttributes"],{"f":"return [\n \"div\",\n $1.concat($2),\n [],\n]"}]]],"OptionalClasses":["/",["Classes",["L","",{"f":"return []"}]]],"Classes":["+","Class"],"Class":["/",[["S",[["L","."],"Identifier"],{"f":"return [\"class\", $2]"}],["S",[["L","."],["!","Identifier"]],{"f":"throw \"Expected a class name\""}],"IdError"]],"OptionalIds":["?","Ids",{"f":"return $1 || []"}],"Ids":["S",["Id"],{"f":"return [ $1 ]"}],"Id":["/",[["S",[["L","#"],"Identifier"],{"f":"return [\"id\", $2]"}],["S",[["L","#"],["!","Identifier"]],{"f":"throw \"Expected an id name\""}]]],"IdError":["L","#",{"f":"throw \"Ids must appear before classes and attributes. Elements can only have one id.\""}],"ClassError":["L",".",{"f":"throw \"Classes cannot appear after attributes.\""}],"TagName":["/",[["S",["Identifier"],1],["S",[["L"," "],"Identifier"],2]]],"OptionalAttributes":["/",[["S",[["L","("],["?","__"],["+","Attribute"],["L",")"],["?","IdError"],["?","ClassError"]],{"f":"return $3"}],["L","(",{"f":"throw \"Invalid attributes\""}],["L","",{"f":"return []"}]]],"Attribute":["/",[["S",["AtIdentifier",["?","__"]],{"f":"return [$1.bind, $1]"}],["S",["EqBinding",["?","__"]],1],["S",["Identifier",["?","__"]],{"f":"return [$1, \"\"]"}]]],"AtIdentifier":["S",[["L","@"],"Identifier"],{"f":"return {\n bind: $2\n}"}],"EqBinding":["S",["Identifier",["L","="],["/",["AtIdentifier","Value"]]],[1,3]],"Identifier":["R","[a-zA-Z][a-zA-Z0-9-]*"],"Indent":["*",["/",[["L"," "],["L","\\t"]]],{"f":"return $1.length"}],"_":["R","[ \\t]+"],"__":["+",["/",[["R","[ \\t]"],"EOL"]]],"Value":["/",[["S",[["L","\\\""],["*","DoubleStringCharacter"],["L","\\\""]],{"f":"return $2.join(\"\")"}],["S",[["L","'"],["*","SingleStringCharacter"],["L","'"]],{"f":"return $2.join(\"\")"}],"Number"]],"DoubleStringCharacter":["/",[["S",[["!",["/",[["L","\\\""],["L","\\\\"]]]],["R","."]],2],["S",[["L","\\\\"],"EscapeSequence"],2]]],"SingleStringCharacter":["/",[["S",[["!",["/",[["L","'"],["L","\\\\"]]]],["R","."]],2],["S",[["L","\\\\"],"EscapeSequence"],2]]],"EscapeSequence":["/",[["L","'"],["L","\\\""],["L","\\\\"],["R",".",{"f":"return \"\\\\\" + $0"}]]],"Number":["/",[["R","-?[0-9]+\\.[0-9]+"],["R","-?[0-9]+"]]],"EOS":["/",[["S",[["+",["S",[["?","_"],"EOL"]]],"_","EOF"]],["+",["S",[["?","_"],"EOL"]]],"EOF"]],"EOL":["/",[["L","\\r\\n"],["L","\\n"],["L","\\r"]]],"EOF":["!",["R","[\\s\\S]"]]}));

},{}],2:[function(require,module,exports){
// Generated by CoffeeScript 2.5.1
Expand Down
Loading