You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a rust library that lexes and parses C source files.
4
+
5
+
## Standard
6
+
7
+
For the moment, this parser is only meant to support C23 standard C code. No extensions (e.g. GCC extensions) are implemented. The input file is supposed already preprocessed.
8
+
9
+
## Lexer
10
+
11
+
The lexer takes as input the preprocessed C source code, and transforms into a valid token: keywords, number constants, identifiers, symbols, strings and chars.
12
+
13
+
## Parser
14
+
15
+
The parser takes these tokens and tries to build an Abstract Syntax Tree (AST). The AST is not meant to be valid as it is building AST so it contains empty nodes while building that are meant to disappear before the end of the parsing stage.
"{filename}:{line_nb}:{column_nb}: format warning: This line of code exceeds the maximum size of {}. Consider refactoring your code. {line_nb:5} | {code_line}\n{under_spaces}^{under_tilde}",
53
+
usize::MAX
54
+
)
55
+
.map_err(|_| ())?;
56
+
}
41
57
}
42
58
Ok(res)
43
59
}
60
+
61
+
/// Decrements a value of 1
62
+
constfnsafe_decrement(val:usize) -> usize{
63
+
val.checked_sub(1)
64
+
.expect("line, col, len are initialised at 1, then incremented")
0 commit comments