Phone_Number.gram
Example
#ABNF 1.0;
mode voice;
language en-US;
tag-format <semantics/1.0>;
root $PhoneNumber;
$Digit = (ONE {out = "1"} |
TWO {out = "2"} |
THREE {out = "3"} |
FOUR {out = "4"} |
FIVE {out = "5"} |
SIX {out = "6"} |
SEVEN {out = "7"} |
EIGHT {out = "8"} |
NINE {out = "9"} |
(ZERO | O) {out = "0"} );|
$AreaCode = { out = "" } ( $Digit { out += rules.Digit } ) <3>;
$Number = { out = "" } ( $Digit { out += rules.latest() } ) <7>;
$PhoneNumber =
(
[AREA CODE | ONE]
$AreaCode { out.areacode = rules.latest() }
$Number { out.number = rules.latest() }
) |
( $Number ) { out.areacode = "858"; out.number = rules.latest() };