mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
switch ra_syntax to new rowan API
This commit is contained in:
parent
55272f2023
commit
d91a98ec84
15 changed files with 266 additions and 327 deletions
|
@ -11,7 +11,7 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
pub(super) fn validate_byte_node(node: ast::Byte, errors: &mut Vec<SyntaxError>) {
|
||||
pub(super) fn validate_byte_node(node: &ast::Byte, errors: &mut Vec<SyntaxError>) {
|
||||
let literal_text = node.text();
|
||||
let literal_range = node.syntax().range();
|
||||
let mut components = string_lexing::parse_byte_literal(literal_text);
|
||||
|
@ -106,11 +106,11 @@ fn validate_byte_code_escape(text: &str, range: TextRange, errors: &mut Vec<Synt
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::SourceFileNode;
|
||||
use crate::{SourceFile, TreePtr};
|
||||
|
||||
fn build_file(literal: &str) -> SourceFileNode {
|
||||
fn build_file(literal: &str) -> TreePtr<SourceFile> {
|
||||
let src = format!("const C: u8 = b'{}';", literal);
|
||||
SourceFileNode::parse(&src)
|
||||
SourceFile::parse(&src)
|
||||
}
|
||||
|
||||
fn assert_valid_byte(literal: &str) {
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
|
||||
use super::byte;
|
||||
|
||||
pub(crate) fn validate_byte_string_node(node: ast::ByteString, errors: &mut Vec<SyntaxError>) {
|
||||
pub(crate) fn validate_byte_string_node(node: &ast::ByteString, errors: &mut Vec<SyntaxError>) {
|
||||
let literal_text = node.text();
|
||||
let literal_range = node.syntax().range();
|
||||
let mut components = string_lexing::parse_byte_string_literal(literal_text);
|
||||
|
@ -43,12 +43,12 @@ pub(crate) fn validate_byte_string_node(node: ast::ByteString, errors: &mut Vec<
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::SourceFileNode;
|
||||
use crate::{SourceFile, TreePtr};
|
||||
|
||||
fn build_file(literal: &str) -> SourceFileNode {
|
||||
fn build_file(literal: &str) -> TreePtr<SourceFile> {
|
||||
let src = format!(r#"const S: &'static [u8] = b"{}";"#, literal);
|
||||
println!("Source: {}", src);
|
||||
SourceFileNode::parse(&src)
|
||||
SourceFile::parse(&src)
|
||||
}
|
||||
|
||||
fn assert_valid_str(literal: &str) {
|
||||
|
|
|
@ -14,7 +14,7 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
pub(super) fn validate_char_node(node: ast::Char, errors: &mut Vec<SyntaxError>) {
|
||||
pub(super) fn validate_char_node(node: &ast::Char, errors: &mut Vec<SyntaxError>) {
|
||||
let literal_text = node.text();
|
||||
let literal_range = node.syntax().range();
|
||||
let mut components = string_lexing::parse_char_literal(literal_text);
|
||||
|
@ -175,11 +175,11 @@ fn validate_unicode_escape(text: &str, range: TextRange, errors: &mut Vec<Syntax
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::SourceFileNode;
|
||||
use crate::{SourceFile, TreePtr};
|
||||
|
||||
fn build_file(literal: &str) -> SourceFileNode {
|
||||
fn build_file(literal: &str) -> TreePtr<SourceFile> {
|
||||
let src = format!("const C: char = '{}';", literal);
|
||||
SourceFileNode::parse(&src)
|
||||
SourceFile::parse(&src)
|
||||
}
|
||||
|
||||
fn assert_valid_char(literal: &str) {
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
|
||||
use super::char;
|
||||
|
||||
pub(crate) fn validate_string_node(node: ast::String, errors: &mut Vec<SyntaxError>) {
|
||||
pub(crate) fn validate_string_node(node: &ast::String, errors: &mut Vec<SyntaxError>) {
|
||||
let literal_text = node.text();
|
||||
let literal_range = node.syntax().range();
|
||||
let mut components = string_lexing::parse_string_literal(literal_text);
|
||||
|
@ -38,12 +38,12 @@ pub(crate) fn validate_string_node(node: ast::String, errors: &mut Vec<SyntaxErr
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::SourceFileNode;
|
||||
use crate::{SourceFile, TreePtr};
|
||||
|
||||
fn build_file(literal: &str) -> SourceFileNode {
|
||||
fn build_file(literal: &str) -> TreePtr<SourceFile> {
|
||||
let src = format!(r#"const S: &'static str = "{}";"#, literal);
|
||||
println!("Source: {}", src);
|
||||
SourceFileNode::parse(&src)
|
||||
SourceFile::parse(&src)
|
||||
}
|
||||
|
||||
fn assert_valid_str(literal: &str) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue