Strip invalid characters from VHDL identifiers.
authorMatthijs Kooijman <m.kooijman@student.utwente.nl>
Thu, 19 Feb 2009 14:06:02 +0000 (15:06 +0100)
committerMatthijs Kooijman <m.kooijman@student.utwente.nl>
Thu, 19 Feb 2009 14:06:02 +0000 (15:06 +0100)
VHDL.hs

diff --git a/VHDL.hs b/VHDL.hs
index 1c7eba9ea2e848fbca70c620357e1b0e9fb09f85..4ab3be33ec2ba1a9a4647d62703e0efb801c811d 100644 (file)
--- a/VHDL.hs
+++ b/VHDL.hs
@@ -326,4 +326,8 @@ vhdl_ty_maybe ty =
 
 -- Shortcut
 mkVHDLId :: String -> AST.VHDLId
-mkVHDLId = AST.unsafeVHDLBasicId
+mkVHDLId s = 
+  AST.unsafeVHDLBasicId s'
+  where
+    -- Strip invalid characters.
+    s' = filter (`elem` ['a'..'z'] ++ ['0'..'9'] ++ ['_']) s