Add C and C++ library support
import "zlib.h" reads the header (cc -E + a small C declaration parser), links via pkg-config or link "name", and builds .c/.cpp files next to the program. C structs become Dino structs, pointers become pointer types (nil = NULL), T* parameters take variables or lists. Adds dino header, editor completion/hover for C names, docs chapter 13, a raylib example, and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b42e2a3bd
commit
2f44f09b6a
26 files changed
+3418
-70
No files matched your search
+4
-3
@@ -35,7 +35,7 @@ const KEYWORDS: &[&str] = &[
|
||||
];
|
||||
|
||||
/// Words that make a following `{` open a block (rather than a struct or map literal).
|
||||
const BLOCK_WORDS: &[&str] = &["func", "if", "for", "match", "struct", "enum", "interface", "else"];
|
||||
const BLOCK_WORDS: &[&str] = &["func", "if", "for", "match", "struct", "enum", "interface", "else", "import"];
|
||||
|
||||
const BINARY: &[&str] = &[
|
||||
"+", "-", "*", "/", "%", "==", "!=", "<", ">", "<=", ">=", "&&", "||", "=", "+=", "-=", "*=", "/=", "%=", "=>",
|
||||
@@ -434,14 +434,15 @@ fn gap(prev: &Piece, cur: &Piece, before_prev: Option<&Piece>, prev_is_prefix: b
|
||||
}
|
||||
"(" => {
|
||||
return match prev.kind {
|
||||
Kind::Word => is_keyword(prev) && prev.text != "func",
|
||||
// `step` is only a keyword inside `for ... step n`; before `(` it is a name
|
||||
Kind::Word => is_keyword(prev) && prev.text != "func" && prev.text != "step",
|
||||
Kind::Punct => !matches!(pt, ")" | "]" | "}"),
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
"[" => {
|
||||
return match prev.kind {
|
||||
Kind::Word => is_keyword(prev),
|
||||
Kind::Word => is_keyword(prev) && prev.text != "step",
|
||||
Kind::Punct => !matches!(pt, ")" | "]"),
|
||||
_ => true,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user