We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://api.github.com/KisaragiEffective/origlang/blob/deaec8386e80690dc705769e8f783a80fe90b15b/package/origlang-compiler/src/lexer/tests.rs#L112
assert_eq!(lexer.consume_char().expect("oops"), S.chars().nth(i).expect("out of bounds from literal")) } } use std::num::NonZeroUsize; use origlang_source_span::{Pointed, SourcePosition}; #[test] fn token_location() { // TODO: var y = 2 w/o new line -> unexpected panic (scan_digits_suffix_opt) let src = "var x = 1\nvar y = 2\n"; let lexer = Lexer::create(src); assert_eq!(lexer.next(), Pointed { data: Token::VarKeyword, position: SourcePosition { line: NonZeroUsize::new(1).unwrap(), column: NonZeroUsize::new(1).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::Identifier { inner: Identifier::new("x".to_string()) }, position: SourcePosition { line: NonZeroUsize::new(1).unwrap(), column: NonZeroUsize::new(5).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::SymEq, position: SourcePosition { line: NonZeroUsize::new(1).unwrap(), column: NonZeroUsize::new(7).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::Digits { sequence: "1".to_string(), suffix: None, }, position: SourcePosition { line: NonZeroUsize::new(1).unwrap(), column: NonZeroUsize::new(9).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::NewLine, position: SourcePosition { line: NonZeroUsize::new(1).unwrap(), column: NonZeroUsize::new(10).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::VarKeyword, position: SourcePosition { line: NonZeroUsize::new(2).unwrap(), column: NonZeroUsize::new(1).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::Identifier { inner: Identifier::new("y".to_string()) }, position: SourcePosition { line: NonZeroUsize::new(2).unwrap(), column: NonZeroUsize::new(5).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::SymEq, position: SourcePosition { line: NonZeroUsize::new(2).unwrap(), column: NonZeroUsize::new(7).unwrap() } }); assert_eq!(lexer.next(), Pointed { data: Token::Digits { sequence: "2".to_string(), suffix: None, }, position: SourcePosition { line: NonZeroUsize::new(2).unwrap(), column: NonZeroUsize::new(9).unwrap() } }); }
The text was updated successfully, but these errors were encountered:
KisaragiEffective
No branches or pull requests
https://api.github.com/KisaragiEffective/origlang/blob/deaec8386e80690dc705769e8f783a80fe90b15b/package/origlang-compiler/src/lexer/tests.rs#L112
The text was updated successfully, but these errors were encountered: