actively re-orging by section

This commit is contained in:
Yehowshua Immanuel 2024-12-06 17:24:58 -05:00
parent 38fb13556f
commit f2ef23d02e
4 changed files with 147 additions and 78 deletions

View file

@ -1,6 +1,10 @@
module RTLILParser.Primitives(
pOctal,
pEscapedChar
pWs
,pNonWs
,pMaybeWs
,pEol
,pOctal
,pEscapedChar
) where
import Control.Monad (void)
@ -9,7 +13,6 @@ import Text.Parsec.String (Parser)
import Data.Char (digitToInt)
import Util(binaryStringToInt, octalStringToInt)
pOctal :: Parser Char
pOctal = do
digits <- count 1 digit -- At least 1 digit
@ -26,4 +29,17 @@ pEscapedChar = do
, char 't' >> return '\t'
, try pOctal
, anyChar
]
]
pMaybeWs :: Parser String
pMaybeWs = many (oneOf " \t")
pWs :: Parser String
pWs = many1 (oneOf " \t")
-- https://github.com/YosysHQ/yosys/blob/111b747d2797238eadf541879848492a9d34909a/frontends/rtlil/rtlil_lexer.l#L88C1-L88C17
pNonWs :: Parser Char
pNonWs = noneOf " \t\r\n"
pEol :: Parser String
pEol = many1 (oneOf "\r\n")