Giter Site home page Giter Site logo

Comments (4)

jojomickymack avatar jojomickymack commented on June 1, 2024

I figured it out! In addition to using the regex as-is, which works fine for matching lines of Text, I created an additional Regex and Matcher which replaces the \G with ^ and uses a substring of the line being tokenized instead of the whole thing.

Regex myRegex = new Regex(rule.regex.pattern.toString().replace("\\G", "^"));
Matcher myMatch = myRegex.match(line.substring(column_number));

Using this new matcher works for directives inside of << and [[, but has issues matching regular lines of text - so in the block with if (rule.type == TokenType.Text), the original matcher is used, and for any other ruletype, token_text = myMatch.group();

My understanding of the actual issue is that on Android's Java 1.6, java.util.regex doesn't do what it's supposed to with the \G symbol.

Here is a fixed version of the Lexer.java file - the edits are on line 289, 293, and 332.

That yarnjava repo I set up so I could pull in the fixed version of yarngdx using jitpack - that might be a good thing for you to take advantage of here btw - all you'd have to do is create a 'release' (otherwise SHAPSHOT is the only option). Jitpack makes it so you can use 'implementation 'com.github.jojomickymack:yarnjava:v1.0' in your core build.gradle file instead of using the jar or java files as described in your readme.md - it's just easier to include your library that way.

In the meantime I'm really happy I can use yarn and keep building for Android!!! Thanks!

from yarngdx.

kyperbelt avatar kyperbelt commented on June 1, 2024

@jojomickymack thanks for the fix! I couldnt test on android myself but it makes sense. I put in the changes and tested that desktop target still functions 👍

Feel free to do pull requests as any help is greatly appreciated :)

as for jitpack - i did try it out and it worked until i tried using it with a few other projects that had a different version of lwjgl and i wasnt able to only include the core module. Maybe I just didnt see a way of doing this but ill definitely take a look into that.

Ill close this issue for now.

from yarngdx.

jojomickymack avatar jojomickymack commented on June 1, 2024

@kyperbelt
Nice - looks like it's not 100% yet - my fault for not highlighting this other change I'd made to get text to parse correctly - I forgot to note that additional line was changed.

line 326 of Lexar.java

So at 0c3c2f0, for android targets the lexar is parsing all non-text lines, but it chokes on text - I believe it's because previously, match.find was getting called on this line, and now it's not. I have to admit, I don't understand why match.find(column_number) does not work for android.

When I change match.find(column_number); to match.find(0); everything works.

Thanks for working on this - I'm not that great with regex and I know this is better left in your hands!

from yarngdx.

jojomickymack avatar jojomickymack commented on June 1, 2024

it's working when I build for android now - thanks!

from yarngdx.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.