Skip to content

Commit

Permalink
move desc values to strings
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneCypher committed May 22, 2017
1 parent d1fb4d9 commit 8861742
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Expand Up @@ -2,7 +2,5 @@ language: node_js
node_js:
- "7"
- "6"
before_install:
- pwd
after_success:
- npm run travis
44 changes: 37 additions & 7 deletions src/js/jssm-dot.peg
Expand Up @@ -11,11 +11,41 @@ TwoWayArrow "two way arrow"
Arrow
= ForwardArrow / TwoWayArrow

String "string"
= QuoteMark chars:Char* QuoteMark { return chars.join(""); }

HexDigit
= [0-9a-fA-F]

Char
= Unescaped
/ Escape Sequence:(
'"'
/ "\\"
/ "/"
/ "b" { return "\b"; }
/ "f" { return "\f"; }
/ "n" { return "\n"; }
/ "r" { return "\r"; }
/ "t" { return "\t"; }
/ "u" digits:$(HexDigit HexDigit HexDigit HexDigit) {
return String.fromCharCode(parseInt(digits, 16));
}
)
{ return Sequence; }

Escape = "\\"
QuoteMark = '"'
Unescaped = [\x20-\x21\x23-\x5B\x5D-\u10FFFF]

Label "label"
= text:[0-9a-zA-Z.+-_]+ { return text.join(''); }
= text:[0-9a-zA-Z\.\+\-\_]+ { return text.join(''); }

DescValue
= string:String

DescItem
= text:Label ":" value:Label ";"
= text:Label ":" value:DescValue ";"

DescItems
= DescItem+
Expand All @@ -29,17 +59,17 @@ Subexp
Whitespace rdesc:ArrowDesc?
Whitespace label:Label
Whitespace tail:Subexp? {
return {kind: arrow, to: label, se:(tail === [])? undefined : tail};
return {kind: arrow, to: label, se:(tail === [])? undefined: tail};
}

SubexpItem
= Subexp

Exp
= label:Label se:Subexp Whitespace ';' Whitespace {
return {from: label, se:(se === [])? undefined : se};
return {from: label, se:(se === [])? undefined: se};
}

SubexpItem
= Subexp

ExpList
= exp:Exp*

Expand Down

0 comments on commit 8861742

Please sign in to comment.