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

closing bracket not always detected #50

Open
Magnymbus opened this issue Jan 26, 2022 · 4 comments
Open

closing bracket not always detected #50

Magnymbus opened this issue Jan 26, 2022 · 4 comments
Milestone

Comments

@Magnymbus
Copy link

Magnymbus commented Jan 26, 2022

getting expecting token of type BR_CLOSE, even though the closing bracket is there and the script works in game. I tried going through the JSON and javascript to try and fix it myself but I have no idea why only the first set is working. I thought it might be a weird regex edge case, but that didn't work.

Here's my script BTW. The bracket pairs in question are the <Container>s

import crafttweaker.api.recipe.type.Recipe;
import crafttweaker.api.recipe.type.CraftingRecipe;
import crafttweaker.api.world.Container;

for recipe in craftingTable.getRecipesByOutput(<tag:items:minecraft:stairs>) {
  println((recipe as Recipe<Container>).resultItem.commandString + ": - " + (recipe as Recipe<Container>).ingredients[0].commandString); 
}
@Magnymbus
Copy link
Author

After some messing around, it seems like it's only detected properly when it's the first part of the token. If any part of the full identifier precedes the "<" it won't find the ">".

@Magnymbus
Copy link
Author

Wait... That means it's probably interpreting that as a lessthan rather than a bracket

@Yesterday17
Copy link
Owner

The extension is (at least for now) ZenScript only. CraftTweaker had an upgrade on Minecraft 1.13+ and upgrade ZenScript to a new language which has similar grammar to the old one, called ZenCode. ZenCode support is WIP. I don't have enough time to develop it, and I'm not familiar with Minecraft in higher version.(Still playing GT New Horizon)

Progress in the past: Lexer and parser are completed, but not integrated in the extension.


For your problem, I believe it's treated as LESS_THAN.


Type parameter exists in ZenCode, which uses <(called T_LESS or LT):

private TypeParameterList ::= T_LESS TypeParameter (T_COMMA TypeParameter)* T_GREATER;

But LT only exists in bracket handler in ZenScript:

@Yesterday17 Yesterday17 added this to the ZenCode milestone Jan 27, 2022
@Magnymbus
Copy link
Author

Just wanted to pop back in to let you know that this seems to actually be fixed in the current build and is only giving me bracket errors in the version on marketplace. In fact, a lot of weird errors are gone now that I've cloned from master rather than using the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants