add: README, LICENSE and initial project structure
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m44s
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m44s
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
zig-out/
|
||||
.zig-cache/
|
||||
9
LICENSE
Normal file
9
LICENSE
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Yves Biener
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
27
README.md
Normal file
27
README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# nf file format - parser
|
||||
|
||||
This is a zig library implementing a parser for `nf` files.
|
||||
|
||||
> [!CAUTION]
|
||||
> Only builds using the zig master version are tested to work.
|
||||
|
||||
## Usage
|
||||
|
||||
To add or update this library as a dependency in your project run the following command:
|
||||
|
||||
```sh
|
||||
zig fetch --save git+https://gitea.yves-biener.de/yves-biener/nf/parser
|
||||
```
|
||||
|
||||
Add the dependency to your module as follows in your *build.zig*:
|
||||
|
||||
```zig
|
||||
const parser: *Dependency = b.dependency("parser", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
// ...
|
||||
exe.root_module.addImport("parser", zterm.module("parser"));
|
||||
```
|
||||
|
||||
Or link against the statically linked library of the parser implementation. To allow updates to the parser without requiring a re-build of the using application and/or library.
|
||||
23
build.zig
Normal file
23
build.zig
Normal file
@@ -0,0 +1,23 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const lib_mod = b.createModule(.{
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const lib = b.addLibrary(.{
|
||||
.linkage = .static,
|
||||
.name = "parser",
|
||||
.root_module = lib_mod,
|
||||
});
|
||||
b.installArtifact(lib);
|
||||
|
||||
const run_lib_unit_tests = b.addRunArtifact(b.addTest(.{ .root_module = lib_mod }));
|
||||
const test_step = b.step("test", "Run unit tests");
|
||||
test_step.dependOn(&run_lib_unit_tests.step);
|
||||
}
|
||||
13
build.zig.zon
Normal file
13
build.zig.zon
Normal file
@@ -0,0 +1,13 @@
|
||||
.{
|
||||
.name = .parser,
|
||||
.version = "0.0.0",
|
||||
.fingerprint = 0x2fb2c373289a7f2b, // Changing this has security and trust implications.
|
||||
.minimum_zig_version = "0.15.0-dev.56+d0911786c",
|
||||
.dependencies = .{},
|
||||
.paths = .{
|
||||
"build.zig",
|
||||
"build.zig.zon",
|
||||
"src",
|
||||
"LICENSE",
|
||||
},
|
||||
}
|
||||
0
src/ast.zig
Normal file
0
src/ast.zig
Normal file
0
src/lexer.zig
Normal file
0
src/lexer.zig
Normal file
1
src/parser.zig
Normal file
1
src/parser.zig
Normal file
@@ -0,0 +1 @@
|
||||
pub const lexer = @import("lexer.zig");
|
||||
6
src/root.zig
Normal file
6
src/root.zig
Normal file
@@ -0,0 +1,6 @@
|
||||
///! Parser for nf file contents. This library provides a lexer and parser and
|
||||
///! emits an AST of valid nf file contents. In case of invalid files,
|
||||
///! corresponding errors are returned. For detailed error messages refer to
|
||||
///! `errorMessage()`
|
||||
pub const ast = @import("ast.zig");
|
||||
pub const parser = @import("parser.zig");
|
||||
Reference in New Issue
Block a user