From 8faf2eb636573b5f3e381eda52b015179c978226 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Fri, 19 May 2023 22:15:14 -0700 Subject: [PATCH] Improve debugging --- demo/demo.rpy | 1 + src/lib.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/demo/demo.rpy b/demo/demo.rpy index d986d46..37049f5 100644 --- a/demo/demo.rpy +++ b/demo/demo.rpy @@ -4,6 +4,7 @@ what the heck "this is a string with a # comment" "this is a string over multiple lines" +"this is \"escaped\"" this is cool # comment huh \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 8670d77..ecba74c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,11 +19,14 @@ pub fn parse(file_path: &str) { for token in line.into_inner() { match token.as_rule() { Rule::token => { - println!("{}", token.as_str()); + let token = token.into_inner().next().unwrap(); + match token.as_rule() { + Rule::string => println!("string: {}", token.as_str()), + Rule::keyword => println!("keyword: {}", token.as_str()), + _ => unreachable!(), + }; }, - _ => { - println!("{}", token.as_str()); - } + _ => unreachable!(), } } println!()