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

Add parser #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add parser #2

wants to merge 1 commit into from

Conversation

dem4ron
Copy link
Member

@dem4ron dem4ron commented Nov 23, 2024

No description provided.

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help! I don't fully understand this change. If I run bun prepare and then check what dist/index.js's content is, it looks like this:

import { LRParser } from '@lezer/lr';
import { LRLanguage, indentNodeProp, delimitedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';
import { styleTags, tags } from '@lezer/highlight';

// This file was generated by lezer-generator. You probably shouldn't edit it.
const parser = LRParser.deserialize({
  version: 14,
  states: "%^QYQPOOO#RQPO'#C_O#YQPO'#C_O#aQPO'#CqOOQO'#Ca'#CaOOQO'#C|'#C|O$eQPO'#CgOOQO'#Cr'#CrO$oQPO'#CiOOQO'#Cq'#CqOOQO'#Ck'#CkQYQPOOO$tQPO'#ClO%{QPO,58yOOQO,58y,58yO&SQPO,58yO!WQPO'#CmO&ZQPO,58yO'hQPO,59ROOQO,59R,59RO'hQPO,59RO'oQPO,59TOOQO-E6i-E6iOOQO-E6j-E6jOOQO1G.e1G.eOOQO,59X,59XOOQO-E6k-E6kOOQO1G.m1G.mO'vQPO1G.mO'}QPO1G.oO!WQPO1G.oOOQO7+$X7+$XO)RQPO7+$Z",
  stateData: "*_~OdOSPOS~OSVOUTOVTOWTOXTOYVO^WOgPOiQOlSOmSOnSOoSOrUO~OSVOUTOVTOWTOXTOYVOgPOiQOlSOmSOnSOoSOrUO~Oh^O~P!WOj^O~P!WOk`OSeXUeXVeXWeXXeXYeX^eXbeXgeXieXleXmeXneXoeXreX~O[dOqcO~P!WOseO~Ok`OS`XU`XV`XW`XX`XY`Xg`Xh`Xi`Xl`Xm`Xn`Xo`Xr`Xj`Xq`X~OhhO~P!WOjhO~P!WOk`OSRaURaVRaWRaXRaYRa^RabRagRaiRalRamRanRaoRarRahRajRaqRa~OqkO~P!WO[nO~P!WOqoO~P!WOk`OS]iU]iV]iW]iX]iY]i^]ib]ig]ii]il]im]in]io]ir]i~Ok`OS]qU]qV]qW]qX]qY]q^]qb]qg]qi]ql]qm]qn]qo]qr]q~O^[WVUYV~",
  goto: "#eqPPPrPrPPPPPrP!RP!V!]!oPPP!x!|PPPPPPPPPrkVOPQUZ]_`bdelnTXOZQZORfZQ]PQ_QQbUWg]_blRldWaR[mpRjaTYOZSROZ`[PQU]_bdlQi`QmeRpn",
  nodeNames: "⚠ LineComment Program Array String Char Integer Floating Fraction SpecialNumber Glyph Inline Signature Binding Identifier",
  maxTerm: 35,
  skippedNodes: [0,1],
  repeatNodeCount: 3,
  tokenData: "6]~R$OX^*Rpq*Rrs*vtu,dxy-_yz-d{|-i}!O-i!O!P-i!P!Q-i!Q![-n![!]-i!]!^/e!^!_-i!_!`-i!`!a-i!a!b-i!b!c/|!c!}4O!}#O4o#P#Q4t#R#S4y#T#o4O#o#p5O#p#q5T#q#r5t#y#z*R$f$g*R$j$k-i$r$s-i$u$v5y$v$w-i$w$x-i%o%p-i&a&b-i0z0{-i5o5p6R5x5y6R5|5}6R#BY#BZ*R$IS$I_*R$Im$In-i$I|$JO*R$JT$JU*R$Jk$Jl-i$KV$KW*R$Kw$Kx-i$Lc$Ld-i$Np$Nq-i%#t%#u6W%#|%#}-i%#}%$O-i%$Z%$[-i%$]%$^-i%$e%$f-i%$q%$r-i%%S%%T-i%%i%%j-i%&[%&]-i%&b%&c-i%&d%&e-i%&r%&s-i%&t%&u-i%&x%&y6R%&z%&{-i%'R%'S-i%'T%'U-i%'V%'W-i%'a%'b-i%'k%'l-i%'y%'z-i%(^%(_-i%(_%(`-i%(b%(c-i%(c%(d-i%)Q%)R-i%)R%)S-i%)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Oo~~0jZo~!Q!R1]#O#P1]#U#V1]#Y#Z1]#b#c1]#f#g1]#g#h1]#h#i1]#i#j1b#j#k1]#l#m3X~1bOn~~1eS!Q![1q!c!i1q#T#Z1q#o#p2l~1tR!Q![1}!c!i1}#T#Z1}~2QR!Q![2Z!c!i2Z#T#Z2Z~2^R!Q![2g!c!i2g#T#Z2g~2lOm~~2oR!Q![2x!c!i2x#T#Z2x~2{S!Q![2x!c!i2x#T#Z2x#q#r2g~3[R!Q![3e!c!i3e#T#Z3e~3hR!Q![3q!c!i3q#T#Z3q~3vOl~~3{Po~;=`<%l0`~4TR^~!c!}4O#R#S4^#T#o4O~4aQ!Q![4g#R#S4^~4lP^~!Q![4g~4tOg~~4yOh~~5OOk~~5TOi~~5WP!Q![5Z~5`Q[~!O!P5f!Q![5Z~5iP!Q![5l~5qP[~!Q![5l~5yOj~~6OPY~!Q![-n~6WOX~~6]Os~",
  tokenizers: [0],
  topRules: {"Program":[0,2]},
  tokenPrec: 421
});

const uiuaLanguage = LRLanguage.define({
    name: "uiua",
    parser: parser.configure({
        props: [
            indentNodeProp.add({
                Application: delimitedIndent({ closing: ")", align: false }),
            }),
            foldNodeProp.add({
                Application: foldInside,
            }),
            styleTags({
                String: tags.string,
                LineComment: tags.lineComment,
                Char: tags.character,
                "Integer SpecialNumber": tags.number,
                "Floating Fraction": tags.float,
                "( )": tags.paren,
                "[ ]": tags.squareBracket,
                "{ }": tags.brace,
                Escape: tags.escape,
                Identifier: tags.function(tags.definition(tags.variableName)),
                Signature: tags.meta,
                Glyph: tags.atom,
            }),
        ],
    }),
    languageData: {
        commentTokens: { line: ";" },
    },
});
function uiua() {
    return new LanguageSupport(uiuaLanguage);
}

export { uiua, uiuaLanguage };

Isn't that correct? And how does this PR fix that?

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

Successfully merging this pull request may close these issues.

2 participants