aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a1e085f..7385d66 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -61,10 +61,17 @@ impl SynNode {
61 (r.start().into(), r.end().into()).into() 61 (r.start().into(), r.end().into()).into()
62 } 62 }
63 63
64 pub fn text(&self) -> String { 64 pub fn kind(&self) -> String {
65 format!("{:?}", self.node.kind()) 65 format!("{:?}", self.node.kind())
66 } 66 }
67 67
68 pub fn text(&self) -> String {
69 match &self.node {
70 NodeOrToken::Node(_) => "".into(),
71 NodeOrToken::Token(t) => format!("{:?}", t.text()),
72 }
73 }
74
68 pub fn from_str(s: &str) -> Result<JsValue, JsValue> { 75 pub fn from_str(s: &str) -> Result<JsValue, JsValue> {
69 FromStr::from_str(s) 76 FromStr::from_str(s)
70 .map(|p: SynNode| JsValue::from(p)) 77 .map(|p: SynNode| JsValue::from(p))