diff --git a/nfp.go b/nfp.go index ba3b020..8d83e7f 100644 --- a/nfp.go +++ b/nfp.go @@ -400,6 +400,13 @@ func (ps *Parser) getTokens() Tokens { ps.Offset++ continue } + if ps.Token.TType == TokenTypeDateTimes && !strings.ContainsAny(NumCodeChars, ps.nextChar()) { + ps.Tokens.add(ps.Token.TValue, ps.Token.TType, ps.Token.Parts) + ps.Tokens.add(ps.currentChar(), TokenTypeLiteral, ps.Token.Parts) + ps.Token = Token{} + ps.Offset++ + continue + } if !ps.InString { if ps.Token.TType != "" && strings.ContainsAny(NumCodeChars, ps.nextChar()) { ps.Tokens.add(ps.Token.TValue, ps.Token.TType, ps.Token.Parts) diff --git a/nfp_test.go b/nfp_test.go index 2cbe017..1460e07 100644 --- a/nfp_test.go +++ b/nfp_test.go @@ -223,6 +223,9 @@ var testStrings [][]string = [][]string{ {`DD/MM/YY;@`, "[{Positive [{DD DateTimes []} {/ Literal []} {MM DateTimes []} {/ Literal []} {YY DateTimes []}]} {Text [{@ TextPlaceHolder []}]}]"}, {`DD/MM/YYYY`, "[{Positive [{DD DateTimes []} {/ Literal []} {MM DateTimes []} {/ Literal []} {YYYY DateTimes []}]}]"}, {`DD/MM/YYYY;@`, "[{Positive [{DD DateTimes []} {/ Literal []} {MM DateTimes []} {/ Literal []} {YYYY DateTimes []}]} {Text [{@ TextPlaceHolder []}]}]"}, + {`DD.MM.YY;@`, "[{Positive [{DD DateTimes []} {. Literal []} {MM DateTimes []} {. Literal []} {YY DateTimes []}]} {Text [{@ TextPlaceHolder []}]}]"}, + {`DD.MM.YYYY`, "[{Positive [{DD DateTimes []} {. Literal []} {MM DateTimes []} {. Literal []} {YYYY DateTimes []}]}]"}, + {`DD.MM.YYYY;@`, "[{Positive [{DD DateTimes []} {. Literal []} {MM DateTimes []} {. Literal []} {YYYY DateTimes []}]} {Text [{@ TextPlaceHolder []}]}]"}, {`DDD`, "[{Positive [{DDD DateTimes []}]}]"}, {`DDDD`, "[{Positive [{DDDD DateTimes []}]}]"}, {`DDDD", "MMMM\ DD", "YYYY`, "[{Positive [{DDDD DateTimes []} {, Literal []} {MMMM DateTimes []} { Literal []} {DD DateTimes []} {, Literal []} {YYYY DateTimes []}]}]"},