> Hi /PeO
...

These were the rules I was using...

let-char: charset[#"a" - #"z" #"A" - #"Z"]
let-digit-char: charset[#"a" - #"z" #"A" - #"Z" #"0" - #"9"]
let-digit-hyph-char: charset[#"a" - #"z" #"A" - #"Z" #"0" - #"9" #"-"]

> >The problem is combining them to a working ruleset...
> 
> The problem is how you formulate your specification. You say:
> >; may have any number of letters, digits and
> >; hyphens in between, but this sequence must
> >; end with a letter or digit if it exists
> 
> This is too general. You need to redefine your rules so that you precisely
> state that a hyphen - if it occurs - must be followed by a letter or digit.
> I.e., I believe you have a let-digit-char rule, your let-digit-hyph-char
> rule then must be:
> 
The hyphen must not be followed by a letter or a digit unless it is the
first of the two last characters.. According to the RFC "a--a" should be a
valid host name (part)... 

BNF rule was.. (not retyped from the RFC, but what I want to implement as a
parse rule)..

let-char [*[let-digit-hyph-char] let-digit-char]

with "[" and "]" marking optional parts as in BNF

That is.. valid host names begins with a letter, ends with a letter or a
digit (which could be the same as the first letter, since one-character
host names are allowed), in between there could be any number of letters,
digits and hyphens in any order.

> let-digit-hyph-char: [ "-" let-digit-char]
> 
That rule will require every hyphen to be followed by a letter or a digit..

> This rule only evaluates to true if a hyphen is immediately followed by a
> character. It permits that a hyphen appear, provided that the hyphen is
> followed by a an obligatory character and thereby excludes the possibility
> of a trailing hyphen.
> 
> Hope this helps
> 
> 
> ;- Elan >> [: - )]
> 
> 

Reply via email to