Skip to content
New issue

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

Allowing array entry characters to be on their own line #18

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions resources/shader.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
shaders:
- slang: glsl430
programs:
- name: default
-
name: default
vs:
path: /Users/ccuddigan/Github/delve-framework/assets/shaders/built/default/default_default_glsl430_vs.glsl
is_binary: false
entry_point: main
inputs:
- slot: 0
-
slot: 0
name: pos
sem_name: TEXCOORD
sem_index: 0
- slot: 1
-
slot: 1
name: color0
sem_name: TEXCOORD
sem_index: 1
- slot: 2
-
slot: 2
name: texcoord0
sem_name: TEXCOORD
sem_index: 2
outputs:
- slot: 0
-
slot: 0
name: color
sem_name: TEXCOORD
sem_index: 0
- slot: 1
-
slot: 1
name: uv
sem_name: TEXCOORD
sem_index: 1
@@ -43,7 +49,8 @@ shaders:
is_binary: false
entry_point: main
inputs:
- slot: 0
-
slot: 0
name: color
sem_name: TEXCOORD
sem_index: 0
@@ -81,23 +88,28 @@ shaders:
name: tex_smp
image_name: tex
sampler_name: smp
- slang: glsl300es
-
slang: glsl300es
programs:
- name: default
-
name: default
vs:
path: /Users/ccuddigan/Github/delve-framework/assets/shaders/built/default/default_default_glsl300es_vs.glsl
is_binary: false
entry_point: main
inputs:
- slot: 0
-
slot: 0
name: pos
sem_name: TEXCOORD
sem_index: 0
- slot: 1
-
slot: 1
name: color0
sem_name: TEXCOORD
sem_index: 1
- slot: 2
-
slot: 2
name: texcoord0
sem_name: TEXCOORD
sem_index: 2
12 changes: 12 additions & 0 deletions src/root.zig
Original file line number Diff line number Diff line change
@@ -305,6 +305,13 @@ pub fn Ymlz(comptime Destination: type) type {
return null;
}

fn isArrayEntryOnlyChar(raw_line: []const u8) bool {
// Trim whitespace to see if this is only the array start char
var trimmed_line = std.mem.trimLeft(u8, raw_line, " ");
trimmed_line = std.mem.trimRight(u8, trimmed_line, " ");
return std.mem.eql(u8, trimmed_line, "-");
}

fn isNewExpression(self: *Self, raw_value_line: []const u8, depth: usize) bool {
const indent_depth = self.getIndentDepth(depth);

@@ -344,6 +351,11 @@ pub fn Ymlz(comptime Destination: type) type {
while (true) {
const raw_value_line = try self.readLine() orelse break;

// If this is only the array entry char '-', just eat this line
if (isArrayEntryOnlyChar(raw_value_line)) {
continue;
}

try self.suspense.set(raw_value_line);

if (self.isNewExpression(raw_value_line, depth)) {