aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated.rs
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <[email protected]>2018-11-08 14:42:00 +0000
committerAdolfo OchagavĂ­a <[email protected]>2018-11-09 13:52:17 +0000
commit3b4c02c19e4af645fd37e8bff774b05d546dc0b6 (patch)
tree42c40e9201adf64d1c06bc1c69524f5688ee6e9f /crates/ra_syntax/src/ast/generated.rs
parent5a9150df9bcdaf5faed5b500c22333f1f7c99f32 (diff)
Validate string literals
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 5b5f71ee7..2e9ae263a 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -3236,6 +3236,43 @@ impl<'a> AstNode<'a> for Stmt<'a> {
3236 3236
3237impl<'a> Stmt<'a> {} 3237impl<'a> Stmt<'a> {}
3238 3238
3239// String
3240#[derive(Debug, Clone, Copy,)]
3241pub struct StringNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3242 pub(crate) syntax: SyntaxNode<R>,
3243}
3244pub type String<'a> = StringNode<RefRoot<'a>>;
3245
3246impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StringNode<R1>> for StringNode<R2> {
3247 fn eq(&self, other: &StringNode<R1>) -> bool { self.syntax == other.syntax }
3248}
3249impl<R: TreeRoot<RaTypes>> Eq for StringNode<R> {}
3250impl<R: TreeRoot<RaTypes>> Hash for StringNode<R> {
3251 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3252}
3253
3254impl<'a> AstNode<'a> for String<'a> {
3255 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3256 match syntax.kind() {
3257 STRING => Some(String { syntax }),
3258 _ => None,
3259 }
3260 }
3261 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
3262}
3263
3264impl<R: TreeRoot<RaTypes>> StringNode<R> {
3265 pub fn borrowed(&self) -> String {
3266 StringNode { syntax: self.syntax.borrowed() }
3267 }
3268 pub fn owned(&self) -> StringNode {
3269 StringNode { syntax: self.syntax.owned() }
3270 }
3271}
3272
3273
3274impl<'a> String<'a> {}
3275
3239// StructDef 3276// StructDef
3240#[derive(Debug, Clone, Copy,)] 3277#[derive(Debug, Clone, Copy,)]
3241pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3278pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {