1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 00:42:33 +03:00
semantic/semantic-rust
2022-02-07 16:16:31 -05:00
..
src/Language Make Rust commensurate with its cabal version. 2020-07-01 20:52:06 -04:00
test fix semantic-rust tests on cabal 2020-07-01 21:03:22 -04:00
BUILD.bazel Make Rust commensurate with its cabal version. 2020-07-01 20:52:06 -04:00
LICENSE semantic-rust initial commit 2020-05-12 21:12:05 +02:00
README.md 🔥 semantic-core. 2022-02-07 16:16:31 -05:00
semantic-rust.cabal Bump semantic-source versions 2020-08-26 16:51:29 -07:00
Setup.hs semantic-rust initial commit 2020-05-12 21:12:05 +02:00

Semantic support for Rust

This package implements semantic support for Rust.

Generating AST

cd semantic-rust
cabal v2-repl
λ> :seti -XOverloadedStrings
λ> :seti -XTypeApplications
λ> import Source.Span
λ> import Source.Range
λ> import AST.Unmarshal
λ> TS.parseByteString @Language.Rust.AST.SourceFile @(Source.Span.Span, Source.Range.Range) Language.Rust.Grammar.tree_sitter_rust "let x = 1;"
Right (SourceFile {ann = (Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 10}},Range {start = 0, end = 10}), extraChildren = [L1 (DeclarationStatement {getDeclarationStatement = R1 (L1 (L1 (R1 (LetDeclaration {ann = (Span {start = Pos {line = 0, column = 0}, end = Pos {line = 0, column = 10}},Range {start = 0, end = 10}), pattern = Pattern {getPattern = L1 (R1 (L1 (L1 (Identifier {ann = (Span {start = Pos {line = 0, column = 4}, end = Pos {line = 0, column = 5}},Range
{start = 4, end = 5}), text = "x"}))))}, value = Just (Expression {getExpression = L1 (L1 (L1 (L1 (L1 (Literal {getLiteral = R1 (L1 (IntegerLiteral {ann = (Span {start = Pos {line = 0, column = 8}, end = Pos {line = 0, column = 9}},Range {start = 8, end = 9}), text = "1"}))})))))}), type' = Nothing, extraChildren = Nothing}))))})]})