Download tasks/format-code-task-000046/tests/test.patch from FineEnvs/MiMo-V2.6-RL-harbor-code: direct link, hf CLI and curl.
- Browser
- Download file 7.47 kB
-
https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000046/tests/test.patch
- Command line
-
hf download hf://datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/tasks/format-code-task-000046/tests/test.patch
-
curl -L -o test.patch https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000046/tests/test.patch
7.47 kB
| diff --git a/test/parse/grammar/interperter_spec.ts b/test/parse/grammar/interperter_spec.ts | |
| index 2d0629124..a7b0c0b7d 100644 | |
| --- a/test/parse/grammar/interperter_spec.ts | |
| +++ b/test/parse/grammar/interperter_spec.ts | |
| import {ITokenGrammarPath} from "../../../src/parse/grammar/path_public" | |
| import { | |
| - ActionTok, | |
| actionDec, | |
| + actionDecSep, | |
| + ActionTok, | |
| + atLeastOneRule, | |
| + atLeastOneSepRule, | |
| + callArguments, | |
| + ColonTok, | |
| + CommaTok, | |
| + DotTok, | |
| IdentTok, | |
| LParenTok, | |
| - RParenTok, | |
| - ColonTok, | |
| - SemicolonTok, | |
| LSquareTok, | |
| - RSquareTok, | |
| - DotTok, | |
| - CommaTok, | |
| paramSpec, | |
| - callArguments, | |
| - actionDecSep, | |
| - atLeastOneRule, | |
| qualifiedNameSep, | |
| - atLeastOneSepRule | |
| + RParenTok, | |
| + RSquareTok, | |
| + SemicolonTok | |
| } from "./samples" | |
| import { | |
| NextAfterTokenWalker, | |
| + nextPossibleTokensAfter, | |
| + NextTerminalAfterAtLeastOneSepWalker, | |
| NextTerminalAfterAtLeastOneWalker, | |
| - NextTerminalAfterManyWalker, | |
| NextTerminalAfterManySepWalker, | |
| - NextTerminalAfterAtLeastOneSepWalker, | |
| - possiblePathsFrom, | |
| - nextPossibleTokensAfter | |
| + NextTerminalAfterManyWalker, | |
| + possiblePathsFrom | |
| } from "../../../src/parse/grammar/interpreter" | |
| -import {setEquality, createRegularToken} from "../../utils/matchers" | |
| +import {createRegularToken, setEquality} from "../../utils/matchers" | |
| import {gast} from "../../../src/parse/grammar/gast_public" | |
| -import {Token, IToken} from "../../../src/scan/tokens_public" | |
| +import {createToken, IToken, Token} from "../../../src/scan/tokens_public" | |
| import {map} from "../../../src/utils/utils" | |
| -import {TokenConstructor} from "../../../src/scan/lexer_public" | |
| +import {Lexer, TokenConstructor} from "../../../src/scan/lexer_public" | |
| import {augmentTokenClasses, tokenStructuredMatcher} from "../../../src/scan/tokens" | |
| +import {Parser} from "../../../src/parse/parser_public" | |
| let RepetitionMandatory = gast.RepetitionMandatory | |
| let Terminal = gast.Terminal | |
| describe("The chevrotain grammar interpreter capabilities", () => { | |
| ], Comma), | |
| new gast.Terminal(Gamma) | |
| ] | |
| - | |
| expect(extractPartialPaths(possiblePathsFrom(rep, 1))).to.deep.equal([[Alpha], [Gamma]]) | |
| expect(extractPartialPaths(possiblePathsFrom(rep, 2))).to.deep.equal([[Alpha, Alpha], [Gamma]]) | |
| - expect(extractPartialPaths(possiblePathsFrom(rep, 3))).to.deep.equal([[Alpha, Alpha, Gamma], [Gamma]]) | |
| - expect(extractPartialPaths(possiblePathsFrom(rep, 4))).to.deep.equal([[Alpha, Alpha, Gamma], [Gamma]]) | |
| + expect(extractPartialPaths(possiblePathsFrom(rep, 3))).to.deep.equal([[Alpha, Alpha, Comma], [Alpha, Alpha, Gamma], [Gamma]]) | |
| + expect(extractPartialPaths(possiblePathsFrom(rep, 4))).to.deep.equal( | |
| + [[Alpha, Alpha, Comma, Alpha], [Alpha, Alpha, Gamma], [Gamma]]) | |
| }) | |
| it("Mandatory Repetition with Separator", () => { | |
| describe("The chevrotain grammar interpreter capabilities", () => { | |
| expect(extractPartialPaths(possiblePathsFrom(repMandSep, 1))).to.deep.equal([[Alpha]]) | |
| expect(extractPartialPaths(possiblePathsFrom(repMandSep, 2))).to.deep.equal([[Alpha, Alpha]]) | |
| - expect(extractPartialPaths(possiblePathsFrom(repMandSep, 3))).to.deep.equal([[Alpha, Alpha, Gamma]]) | |
| - expect(extractPartialPaths(possiblePathsFrom(repMandSep, 4))).to.deep.equal([[Alpha, Alpha, Gamma]]) | |
| + expect(extractPartialPaths(possiblePathsFrom(repMandSep, 3))).to.deep.equal([[Alpha, Alpha, Comma], [Alpha, Alpha, Gamma]]) | |
| + expect(extractPartialPaths(possiblePathsFrom(repMandSep, 4))).to.deep.equal( | |
| + [[Alpha, Alpha, Comma, Alpha], [Alpha, Alpha, Gamma]]) | |
| }) | |
| it("NonTerminal", () => { | |
| describe("The chevrotain grammar interpreter capabilities", () => { | |
| expect(nextPossibleTokensAfter(seq, INPUT([Alpha, Beta, Gamma]), tokenStructuredMatcher, 5)).to.be.empty | |
| }) | |
| }) | |
| +}) | |
| + | |
| +describe("issue 391 - WITH_SEP variants do not take SEP into account in lookahead", () => { | |
| + it("Reproduce issue", () => { | |
| + | |
| + const LParen = createToken({name: "LParen", pattern: /\(/}) | |
| + const RParen = createToken({name: "RParen", pattern: /\)/}) | |
| + const Comma = createToken({name: "Comma", pattern: /,/}) | |
| + const FatArrow = createToken({name: "FatArrow", pattern: /=>/}) | |
| + const Identifier = createToken({name: "Identifier", pattern: /[a-zA-Z]+/}) | |
| + const WhiteSpace = createToken({name: "WhiteSpace", pattern: /\s+/, group: Lexer.SKIPPED}) | |
| + | |
| + const allTokens = [WhiteSpace, LParen, RParen, Comma, FatArrow, Identifier] | |
| + const issue391Lexer = new Lexer(allTokens) | |
| + class Issue391Parser extends Parser { | |
| + constructor(input:Token[] = []) { | |
| + super(input, allTokens, {maxLookahead: 4}); | |
| + (Parser as any).performSelfAnalysis(this) | |
| + } | |
| + | |
| + topRule = this.RULE("topRule", () => { | |
| + return this.OR1([ | |
| + { | |
| + | |
| + ALT: () => { | |
| + this.CONSUME1(LParen) | |
| + this.MANY_SEP({ | |
| + SEP: Comma, | |
| + DEF: () => { | |
| + this.CONSUME1(Identifier) | |
| + } | |
| + }) | |
| + this.CONSUME1(RParen) | |
| + this.CONSUME1(FatArrow) | |
| + } | |
| + }, | |
| + { | |
| + | |
| + ALT: () => { | |
| + this.CONSUME2(LParen) | |
| + this.CONSUME2(Identifier) | |
| + this.CONSUME2(RParen) | |
| + } | |
| + }, | |
| + ]) | |
| + }) | |
| + } | |
| + | |
| + expect(() => new Issue391Parser([])).to.not.throw("Ambiguous alternatives: <1 ,2>") | |
| + const myParser = new Issue391Parser([]) | |
| + | |
| + function testInput(input) { | |
| + const tokens = issue391Lexer.tokenize(input).tokens | |
| + myParser.input = tokens | |
| + myParser.topRule() | |
| + expect(myParser.errors).to.be.empty | |
| + } | |
| + | |
| + testInput("(x, y) => ") | |
| + testInput("() =>") | |
| + testInput("(x) =>") | |
| + testInput("(x)") | |
| + }) | |
| }) | |
| diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64 | |
| new file mode 100644 | |
| --- /dev/null | |
| +++ b/mimo_build_env.tar.gz.b64 | |
| +H4sIAAAAAAAAA+3SQU+DMBgGYM78ii/xbKEM2A/Y3YPzTqB0o4ZR0pbp/r0fmOhiortsMcb3OVBI | |
| +268tb0Uzmb6t9HBMoltJ2boolpZ9bZd3WWQyW0m5zmWUSlmsy4iKm+3ozORD7YgiZ234adyl/j9K | |
| +fOYftA+VsodDPbTCd9db41L+q1J+5F+WOeefl5LzT6+3he/98/xVS0vwjW7j+I62LyaojoKlB9tq | |
| +8ewpS2lnHfG9GOtgGtObcCIe1dHTadRb5cwYKBMrkcetPt779wIDz+apc8kNzzS9Ph/u7eSU9sQX | |
| +jebFfTyMrxS8msc/TgOFThPHstdh6acdF4jnmtXBtlOvfSIaMyT8pbqaRNKbZjlFMtbO62Tvar7F | |
| +LjFD0G7Ujp+VH7Xi88S//cMBAAAAAAAAAAAAAAAAAAAAAK7oDZKdjQMAKAAA | |
| diff --git a/mimo_test_command.sh b/mimo_test_command.sh | |
| new file mode 100755 | |
| --- /dev/null | |
| +++ b/mimo_test_command.sh | |
| +#!/usr/bin/env bash | |
| + | |
| +set -uo pipefail | |
| +cd /testbed || exit 1 | |
| +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 | |
| +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' | |