Skip to content

Commit

Permalink
Juniper: add UINT8/16/32 tokens, replace DEC with dec rule (#6643)
Browse files Browse the repository at this point in the history
To allow incremental migration to sanity for numbers.
  • Loading branch information
dhalperi committed Feb 19, 2021
1 parent 6dbc6e5 commit b51b78a
Show file tree
Hide file tree
Showing 18 changed files with 1,000 additions and 616 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6294,11 +6294,6 @@ DASH
'-'
;

DEC
:
F_Digit+
;

DOLLAR
:
'$'
Expand Down Expand Up @@ -6430,6 +6425,28 @@ WS
F_WhitespaceChar+ -> channel ( HIDDEN )
;

// Numbers. Order matters!

UINT8
:
F_Uint8
;

UINT16
:
F_Uint16
;

UINT32
:
F_Uint32
;

DEC
:
F_Digit+
;

fragment
F_DecByte
:
Expand Down Expand Up @@ -6811,6 +6828,16 @@ F_Variable_LeadingVarChar_Ipv6
~[ \t\n\r:;{}<>[\]&|()"']
;
fragment
F_Uint8
:
F_Digit
| F_PositiveDigit F_Digit
| '1' F_Digit F_Digit
| '2' [0-4] F_Digit
| '25' [0-5]
;
fragment
F_Uint16
:
Expand All @@ -6823,6 +6850,26 @@ F_Uint16
| '6553' [0-5]
;
fragment
F_Uint32
:
// 0-4294967295
F_Digit
| F_PositiveDigit F_Digit F_Digit? F_Digit? F_Digit? F_Digit? F_Digit?
F_Digit? F_Digit?
| [1-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
F_Digit
| '4' [0-1] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '42' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '429' [0-3] F_Digit F_Digit F_Digit F_Digit F_Digit F_Digit
| '4294' [0-8] F_Digit F_Digit F_Digit F_Digit F_Digit
| '42949' [0-5] F_Digit F_Digit F_Digit F_Digit
| '429496' [0-6] F_Digit F_Digit F_Digit
| '4294967' [0-1] F_Digit F_Digit
| '42949672' [0-8] F_Digit
| '429496729' [0-5]
;
fragment
F_Variable_VarChar
:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,5 @@ vlt_l3_interface

vlt_vlan_id
:
VLAN_ID id = DEC
VLAN_ID id = dec
;
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ aat_icmp_type

aat_icmp6_code
:
ICMP6_CODE code = DEC
ICMP6_CODE code = dec
;

aat_icmp6_type
:
ICMP6_TYPE type = DEC
ICMP6_TYPE type = dec
;

aat_inactivity_timeout
:
INACTIVITY_TIMEOUT
(
DEC
dec
| NEVER
)
;
Expand All @@ -120,7 +120,7 @@ aat_protocol

aat_rpc_program_number
:
RPC_PROGRAM_NUMBER DEC
RPC_PROGRAM_NUMBER dec
;

aat_source_port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ b_disable_4byte_as

b_drop_path_attributes
:
DROP_PATH_ATTRIBUTES attr = DEC
DROP_PATH_ATTRIBUTES attr = dec
;

b_enable
Expand Down Expand Up @@ -246,7 +246,7 @@ b_peer_as

b_preference
:
PREFERENCE pref = DEC
PREFERENCE pref = dec
;

b_remove_private
Expand All @@ -262,7 +262,7 @@ b_remove_private

b_tcp_mss
:
TCP_MSS DEC
TCP_MSS dec
;

b_type
Expand All @@ -279,15 +279,15 @@ bf_accepted_prefix_limit
ACCEPTED_PREFIX_LIMIT
(
(
MAXIMUM max = DEC
MAXIMUM max = dec
)
|
(
TEARDOWN limit_threshold = DEC?
TEARDOWN limit_threshold = dec?
(
IDLE_TIMEOUT
(
idle_timeout = DEC
idle_timeout = dec
| FOREVER
)
)?
Expand Down Expand Up @@ -403,7 +403,7 @@ bfiu_add_path

bfiu_loops
:
LOOPS count = DEC
LOOPS count = dec
;

bfiu_prefix_limit
Expand Down Expand Up @@ -432,7 +432,7 @@ bfiua_send

bfiuas_path_count
:
PATH_COUNT count = DEC
PATH_COUNT count = dec
;

bfiuas_prefix_policy
Expand All @@ -454,7 +454,7 @@ bl_common

bl_loops
:
LOOPS DEC
LOOPS dec
;

bl_number
Expand All @@ -474,7 +474,7 @@ bm_no_nexthop_change

bm_ttl
:
TTL DEC
TTL dec
;

bpa_as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ options {

administrator_as
:
DEC L
dec L
;

administrator_dec
:
DEC
dec
;

administrator_dotted_as
:
DEC PERIOD DEC
dec PERIOD dec
;

administrator_ip
:
DEC PERIOD DEC PERIOD DEC PERIOD DEC
dec PERIOD dec PERIOD dec PERIOD dec
;

apply
Expand Down Expand Up @@ -65,8 +65,16 @@ as_unit

bgp_asn
:
asn = DEC
| asn4hi = DEC PERIOD asn4lo = DEC
asn = dec
| asn4hi = dec PERIOD asn4lo = dec
;

dec
:
UINT8
| UINT16
| UINT32
| DEC
;

description
Expand All @@ -84,12 +92,12 @@ ec_administrator

ec_literal
:
DEC COLON DEC COLON DEC
dec COLON dec COLON dec
;

ec_named
:
ec_type COLON ec_administrator COLON assigned_number = DEC
ec_type COLON ec_administrator COLON assigned_number = dec
;

ec_type
Expand All @@ -106,7 +114,7 @@ extended_community

icmp_code
:
DEC
dec
| COMMUNICATION_PROHIBITED_BY_FILTERING
| DESTINATION_HOST_PROHIBITED
| DESTINATION_HOST_UNKNOWN
Expand Down Expand Up @@ -135,7 +143,7 @@ icmp_code

icmp_type
:
DEC
dec
| DESTINATION_UNREACHABLE
| ECHO_REPLY
| ECHO_REQUEST
Expand Down Expand Up @@ -164,7 +172,7 @@ icmp6_only_type

interface_id
:
(node=variable COLON)? name = INTERFACE_NAME (COLON chnl=DEC)? (PERIOD unit = DEC)?
(node=variable COLON)? name = INTERFACE_NAME (COLON chnl=dec)? (PERIOD unit = dec)?
;


Expand All @@ -183,7 +191,7 @@ ip_option
ip_protocol
:
AH
| DEC
| dec
| DSTOPTS
| EGP
| ESP
Expand Down Expand Up @@ -474,7 +482,7 @@ port
| BOOTPS
| CMD
| CVSPSERVER
| DEC
| dec
| DHCP
| DOMAIN
| EKLOGIN
Expand Down Expand Up @@ -564,7 +572,7 @@ range

bandwidth
:
base = DEC
base = dec
(
C
| K
Expand Down Expand Up @@ -605,15 +613,33 @@ string

subrange
:
low = DEC
low = dec
(
DASH high = DEC
DASH high = dec
)?
;

threshold
:
THRESHOLD value = DEC
THRESHOLD value = dec
;

uint8
:
UINT8
;

uint16
:
UINT8
| UINT16
;

uint32
:
UINT8
| UINT16
| UINT32
;

variable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ e_multicast_mode

e_vni_options
:
VNI_OPTIONS VNI id = DEC (
VNI_OPTIONS VNI id = dec (
evo_designated_forwarder_election_hold_time
| evo_vrf_target
)+
;

evo_designated_forwarder_election_hold_time
:
DESIGNATED_FORWARDER_ELECTION_HOLD_TIME secs = DEC
DESIGNATED_FORWARDER_ELECTION_HOLD_TIME secs = dec
;

evo_vrf_target
Expand Down Expand Up @@ -85,5 +85,5 @@ p_evpn

vt_community
:
TARGET COLON x = DEC COLON y = DEC
TARGET COLON x = dec COLON y = dec
;

0 comments on commit b51b78a

Please sign in to comment.