Skip to content

Instantly share code, notes, and snippets.

@Amakata
Created December 31, 2016 13:16
Show Gist options
  • Save Amakata/c89f7db9ec17215ca365f0b1c50b79ff to your computer and use it in GitHub Desktop.
Save Amakata/c89f7db9ec17215ca365f0b1c50b79ff to your computer and use it in GitHub Desktop.
kpegでシングルクオート文字列をparse
```
# クオートで囲った文字列 クオートの中で「\'」を使うことで「'」表現することができる。「\\」を使うことで「\」を表現することができる。
QuoteString = "'" QuoteStringElement+:cc "'" { cc.join }
QuoteStringElement = ( QuoteStringSingleQuote
| QuoteStringBackslash
| QuoteStringOtherchar
)
QuoteStringSingleQuote = "\\'" { "'" }
QuoteStringBackslash = "\\\\" { "\\" }
QuoteStringOtherchar = < /[^']/ > { text }
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment