~ubuntu-branches/ubuntu/utopic/ruby-kpeg/utopic

« back to all changes in this revision

Viewing changes to examples/phone_number/phone_number.kpeg

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont
  • Date: 2014-04-15 09:01:50 UTC
  • Revision ID: package-import@ubuntu.com-20140415090150-b3pvbpg66n78yp4x
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%% name = PhoneNumber
 
2
 
 
3
%% {
 
4
        attr_accessor :phone_number
 
5
}
 
6
digit = [0-9]
 
7
space = " "
 
8
dash = "-"
 
9
LP = "("
 
10
RP = ")"
 
11
 
 
12
country_code = < digit > { text }
 
13
area_code = < digit[3] > { text }
 
14
prefix = < digit[3] > { text }
 
15
suffix = < digit[4] > { text }
 
16
 
 
17
phone_number = LP? area_code:ac RP? space* prefix:p space* dash? space* suffix:s space* { "(#{ac}) #{p}-#{s}" } 
 
18
 
 
19
root = phone_number:pn { @phone_number = pn }
 
20
                | country_code:c space* phone_number:pn { @phone_number = "+#{c} #{pn}" }
 
 
b'\\ No newline at end of file'