Projektmodule und vollständiges TBC-Kompilat umsetzen und Change archivieren
This commit is contained in:
@@ -342,6 +342,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
}
|
||||
let start = i;
|
||||
let pos = SourcePos {
|
||||
source: 0,
|
||||
line: line_no,
|
||||
column: (start + 1) as u32,
|
||||
};
|
||||
@@ -413,6 +414,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
TokenKind::Num(NumValue::Int(v as u16 as i16))
|
||||
} else {
|
||||
diagnostics.push(Diagnostic {
|
||||
file: None,
|
||||
pos,
|
||||
message: "Overflow".into(),
|
||||
});
|
||||
@@ -421,6 +423,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
tokens.push(Token { kind, pos });
|
||||
}
|
||||
Err(_) => diagnostics.push(Diagnostic {
|
||||
file: None,
|
||||
pos,
|
||||
message: "Syntax error".into(),
|
||||
}),
|
||||
@@ -496,6 +499,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
(Some(Suffix::Integer), _) => {
|
||||
if dval > i16::MAX as f64 || dval < i16::MIN as f64 {
|
||||
diagnostics.push(Diagnostic {
|
||||
file: None,
|
||||
pos,
|
||||
message: "Overflow".into(),
|
||||
});
|
||||
@@ -505,6 +509,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
(Some(Suffix::Long), _) => {
|
||||
if dval > i32::MAX as f64 || dval < i32::MIN as f64 {
|
||||
diagnostics.push(Diagnostic {
|
||||
file: None,
|
||||
pos,
|
||||
message: "Overflow".into(),
|
||||
});
|
||||
@@ -518,6 +523,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
}
|
||||
(Some(Suffix::Str), _) => {
|
||||
diagnostics.push(Diagnostic {
|
||||
file: None,
|
||||
pos,
|
||||
message: "Syntax error".into(),
|
||||
});
|
||||
@@ -674,6 +680,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
}
|
||||
other => {
|
||||
diagnostics.push(Diagnostic {
|
||||
file: None,
|
||||
pos,
|
||||
message: format!("Syntax error ('{other}')"),
|
||||
});
|
||||
@@ -692,6 +699,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
tokens.push(Token {
|
||||
kind: TokenKind::Eol,
|
||||
pos: SourcePos {
|
||||
source: 0,
|
||||
line: line_no,
|
||||
column: (chars.len() + 1) as u32,
|
||||
},
|
||||
@@ -704,6 +712,7 @@ pub fn lex(source: &str) -> LexOutput {
|
||||
tokens.push(Token {
|
||||
kind: TokenKind::Eof,
|
||||
pos: SourcePos {
|
||||
source: 0,
|
||||
line: (source.lines().count() + 1) as u32,
|
||||
column: 1,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user