Created
May 9, 2017 21:02
-
-
Save samcv/9c08cbff64bb8b21d18cbbf9e37536f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#÷ [0.2] SPACE (Other) ÷ [999.0] SPACE (Other) ÷ [0.3] | |
# Default Grapheme Break Test | |
# | |
# Format: | |
# <string> (# <comment>)? | |
# <string> contains hex Unicode code points, with | |
# ÷ wherever there is a break opportunity, and | |
# × wherever there is not. | |
# <comment> the format can change, but currently it shows: | |
# - the sample character name | |
# - (x) the Grapheme_Cluster_Break property value for the sample character | |
# - [x] the rule that determines whether there is a break or not | |
grammar GraphemeBreakTest { | |
token TOP { [<.ws> [<break-nobreak>] <.ws>]+ % <hex> <comment> } | |
token break-nobreak { | |
<nobreak> | <break> | |
} | |
token hex { | |
<:AHex>+ | |
} | |
token nobreak { | |
'÷' | |
} | |
token break { | |
'×' | |
} | |
token comment { | |
'#' .* $ | |
} | |
} | |
class parser { | |
method TOP ($/) { | |
say $/.list | |
} | |
#method hex ($/) { | |
# say :16(~$/); | |
#} | |
} | |
GraphemeBreakTest.new.parse( | |
'÷ 0021 ÷ 0020 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] SPACE (Other) ÷ [0.3]' | |
, actions => parser.new | |
).made; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment