Skip to contentSkip to conversation

dtc: Fix recognition of whitespace characters

PATCH Applied David Gibson 2 participants 2 messages Jun 7, 2007

lore
Share & tools
lore
#0 lore raw

At present, the lexer in dtc recognizes only space, tab and newline as whitespace characters. This is broken; in particular this means that dtc will get syntax errors on files with DOS-style (CR-LF) newlines.

This patch fixes the problem, using flex's built-int [:space:] character class.

---

Jon, please apply.

dtc-lexer.l +1 -1
Index: dtc/dtc-lexer.l
===================================================================
@@ -27,7 +27,7 @@
 
 PROPCHAR	[a-zA-Z0-9,._+*#?-]
 UNITCHAR	[0-9a-f,]
-WS		[ \t\n]
+WS		[[:space:]]
 
 REFCHAR		({PROPCHAR}|{UNITCHAR}|[/@])
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Applied
#1 lore raw

So, like, the other day David Gibson mumbled:

Quoted 3 lines

At present, the lexer in dtc recognizes only space, tab and newline as whitespace characters. This is broken; in particular this means that dtc will get syntax errors on files with DOS-style (CR-LF) newlines.

Doctor, it hurts when I use DOS. :-)

Quoted 7 lines

This patch fixes the problem, using flex's built-int [:space:] character class.

---

Jon, please apply.

Applied.

Thanks,
jdl