mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
📝s.
This commit is contained in:
parent
8a506e5efa
commit
14c12b3582
@ -49,7 +49,7 @@ treeSitterParser language grammar blob = do
|
|||||||
|
|
||||||
-- | Parse Ruby to AST. Intended for use in ghci, e.g.:
|
-- | Parse Ruby to AST. Intended for use in ghci, e.g.:
|
||||||
--
|
--
|
||||||
-- > Source.readAndTranscodeFile "/Users/rob/Desktop/test.rb" >>= parseRubyToAST >>= pure . uncurry (assignAll assignment) . second pure
|
-- > Command.Files.readFile "/Users/rob/Desktop/test.rb" >>= parseRubyToAST . source
|
||||||
parseRubyToAST :: Source -> IO (A.AST Ruby.Grammar)
|
parseRubyToAST :: Source -> IO (A.AST Ruby.Grammar)
|
||||||
parseRubyToAST source = do
|
parseRubyToAST source = do
|
||||||
document <- ts_document_new
|
document <- ts_document_new
|
||||||
@ -77,6 +77,9 @@ parseRubyToAST source = do
|
|||||||
anaM g = a where a = pure . embed <=< traverse a <=< g
|
anaM g = a where a = pure . embed <=< traverse a <=< g
|
||||||
|
|
||||||
|
|
||||||
|
-- | Parse Ruby to a list of Terms, printing any assignment errors to stdout. Intended for use in ghci, e.g.:
|
||||||
|
--
|
||||||
|
-- > Command.Files.readFile "/Users/rob/Desktop/test.rb" >>= parseRubyToTerm . source
|
||||||
parseRubyToTerm :: Source -> IO (Maybe [Term Ruby.Syntax A.Location])
|
parseRubyToTerm :: Source -> IO (Maybe [Term Ruby.Syntax A.Location])
|
||||||
parseRubyToTerm source = do
|
parseRubyToTerm source = do
|
||||||
ast <- parseRubyToAST source
|
ast <- parseRubyToAST source
|
||||||
|
Loading…
Reference in New Issue
Block a user