Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tree-sitter grammar for R

License

NotificationsYou must be signed in to change notification settings

r-lib/tree-sitter-r

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An R grammar fortree-sitter.

R package

This grammar is available as anR package.

You'll also want theR package providing bindings to tree-sitter itself.

Rust bindings

This grammar is available as aRust crate on crates.io.

Node bindings

This grammar is available as annpm package.

Note that it is currently listed as a scoped package under the name@davisvaughan/tree-sitter-r.We are working with the npm team to gain ownership of thetree-sitter-r package.Once that happens, we will move the npm package there instead.

References

Known deviations

This section describes known deviations from the R grammar.

]] as a literal token

The following is valid R syntax, note how]] has been split over multiple lines.

x[["a"]]

This applies to]], but not to[[, for example, this is not valid R syntax:

x[["a"]]

The technical reason for this is thatin the grammar R treats[[ as a single token, but]] is treated as two individual] tokens.Treating]] as two individual] tokens allows whitespace, newlines, and even comments to appear between the two] tokens:

x[["a"]# comment]

While we'd like to precisely support the R grammar, it is also extremely useful to treat all of(,),[,],[[, and]] as literal tokens when using the tree-sitter grammar.This allows you to treat call, subset, and subset2 nodes in the same way, since they all have exactly the same node structure.

Because treating]] as a literal token is so useful, and because we've never seen any R code "in the wild" written this way, this grammar does not allow whitespace, newlines, or comments between the two] tokens.


[8]ページ先頭

©2009-2025 Movatter.jp