Skip to content

Commit

Permalink
Preserve rule names used in specifications (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfhandl authored Dec 7, 2023
1 parent ec5bb49 commit 0331790
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
19 changes: 12 additions & 7 deletions abnf/odata-abnf-construction-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -923,11 +923,11 @@ primitiveLiteral = null
/ geometryPolygon

; in CSDL XML DefaultValue attributes
primitiveValue = boolean
/ guid
primitiveValue = booleanValue
/ guidValue
/ durationValue
/ dateTimeOffsetValue
/ date
/ dateValue
/ timeOfDayValue
/ enumValue
/ fullCollectionLiteral
Expand All @@ -941,7 +941,7 @@ primitiveValue = boolean
/ doubleValue
/ singleValue
/ sbyteValue
/ byte
/ byteValue
/ int16Value
/ int32Value
/ int64Value
Expand All @@ -956,7 +956,8 @@ base64b16 = 2base64char ( %s"A" / %s"E" / %s"I" / %s"M" / %s"Q" / %s"U" / %s
base64b8 = base64char ( %s"A" / %s"Q" / %s"g" / %s"w" ) [ "==" ]
base64char = ALPHA / DIGIT / "-" / "_"

boolean = "true" / "false"
boolean = "true" / "false"
booleanValue = %s"true" / %s"false"

decimalLiteral = [ SIGN ] 1*DIGIT [ "." 1*DIGIT ] [ "e" [ SIGN ] 1*DIGIT ] / nanInfinity
decimalValue = ["+"/"-"] 1*DIGIT [ "." 1*DIGIT ] [ "e" ["+"/"-"] 1*DIGIT ] / nanInfinity
Expand All @@ -966,9 +967,11 @@ singleLiteral = decimalLiteral ; IEEE 754 binary32 floating-point number (6-9 d
singleValue = decimalValue ; IEEE 754 binary32 floating-point number (6-9 decimal digits)
nanInfinity = %s"NaN" / %s"-INF" / %s"INF"

guid = 8HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 12HEXDIG
guid = 8HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 4HEXDIG "-" 12HEXDIG
guidValue = guid

byte = 1*3DIGIT ; numbers in the range from 0 to 255
byteValue = byte
sbyteLiteral = [ SIGN ] 1*3DIGIT ; numbers in the range from -128 to 127
sbyteValue = ["+"/"-"] 1*3DIGIT ; numbers in the range from -128 to 127
int16Literal = [ SIGN ] 1*5DIGIT ; numbers in the range from -32768 to 32767
Expand All @@ -981,9 +984,11 @@ int64Value = ["+"/"-"] 1*19DIGIT ; numbers in the range from -9223372036854775
stringLiteral = SQUOTE *( SQUOTE-in-string / pchar-no-SQUOTE ) SQUOTE
SQUOTE-in-string = SQUOTE SQUOTE ; two consecutive single quotes represent one within a string literal

date = year "-" month "-" day
date = year "-" month "-" day
dateValue = date

dateTimeOffsetLiteral = date "T" timeOfDayLiteral ( "Z" / SIGN hour COLON minute )
dateTimeOffsetValueInUrl = dateTimeOffsetLiteral ; legacy name referenced in Temporal spec
dateTimeOffsetValue = date "T" timeOfDayValue ( "Z" / ("+"/"-") hour ":" minute )

durationLiteral = [ "duration" ] SQUOTE durationValue SQUOTE
Expand Down
23 changes: 18 additions & 5 deletions abnf/odata-abnf-testcases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,21 @@ TestCases:
Rule: boolean
Input: tRUe

- Name: Date in URL or body
- Name: Boolean - payload values are lowercase
Rule: booleanValue
Input: tRUe
FailAt: 0

- Name: Boolean - payload values are lowercase
Rule: booleanValue
Input: "true"

- Name: Date in URL
Rule: date
Input: 2012-09-03

- Name: Date
Rule: date
- Name: Date in body or DefaultValue
Rule: dateValue
Input: 2012-09-10

- Name: Date
Expand Down Expand Up @@ -429,10 +438,14 @@ TestCases:
FailAt: 19
Input: 2012-09-03T23:59+01%3A00

- Name: "DateTimeOffset: with percent-encoding"
- Name: "DateTimeOffset: with percent-encoding in URLs"
Rule: dateTimeOffsetLiteral
Input: 2012-09-03T23%3A59%2B01%3A00

- Name: DateTimeOffset - legacy rule name for Temporal spec
Rule: dateTimeOffsetValueInUrl
Input: 2012-09-03T23%3A59%2B01%3A00

- Name: Decimal
Rule: decimalValue
Input: "3.14"
Expand Down Expand Up @@ -548,7 +561,7 @@ TestCases:
Input: "+0.314e+1"

- Name: Byte
Rule: byte
Rule: byteValue
Input: "255"

- Name: SByte in URL
Expand Down

0 comments on commit 0331790

Please sign in to comment.