Giter Club home page Giter Club logo

fluent-multiline-bug's Introduction

Minimal Example for Fluent Issue #191

This is a minimal reproduction of the issue projectfluent/fluent-rs#191.

The expected successful output of the program is the following:

Contents of test.ftl:

simple-message = Hello
multiline-message = Hello this is
    a multiline message
    using fluent.
multiline-message-selector = { $size ->
        [big] Big
        *[medium] Medium
        [small] Small
    }
simple-arg = Hello {$name}

Successfully found entry: Entry(Message(Message { id: Identifier { name: "simple-message" }, value: Some(Pattern { elements: [TextElement("Hello")] }), attributes: [], comment: None }))
Successfully found entry: Entry(Message(Message { id: Identifier { name: "simple-arg" }, value: Some(Pattern { elements: [TextElement("Hello "), Placeable(InlineExpression(VariableReference { id: Identifier { name: "name" } }))] }), attributes: [], comment: None }))
Successfully found entry: Entry(Message(Message { id: Identifier { name: "multiline-message" }, value: Some(Pattern { elements: [TextElement("Hello this is\n"), TextElement("a multiline message\n"), TextElement("using fluent.")] }), attributes: [], comment: None }))
Successfully found entry: Entry(Message(Message { id: Identifier { name: "multiline-message-selector" }, value: Some(Pattern { elements: [Placeable(SelectExpression { selector: VariableReference { id: Identifier { name: "size" } }, variants: [Variant { key: Identifier { name: "big" }, value: Pattern { elements: [TextElement("Big")] }, default: false }, Variant { key: Identifier { name: "medium" }, value: Pattern { elements: [TextElement("Medium")] }, default: true }, Variant { key: Identifier { name: "small" }, value: Pattern { elements: [TextElement("Small")] }, default: false }] })] }), attributes: [], comment: None }))

To reproduce the issue, ensure that the test.ftl is saved as CRLF. On unix, by default it is LF.

The expected output when the error occurs is the following:

Contents of test.ftl:

simple-message = Hello
multiline-message = Hello this is
    a multiline message
    using fluent.
multiline-message-selector = { $size ->
        [big] Big
        *[medium] Medium
        [small] Small
    }
simple-arg = Hello {$name}

The following errors occurred while parsing test.ftl:
[ParserError { pos: (142, 143), slice: Some((103, 219)), kind: ExpectedToken('\n') }]
Successfully found entry: Entry(Message(Message { id: Identifier { name: "simple-message" }, value: Some(Pattern { elements: [TextElement("Hello")] }), attributes: [], comment: None }))
Successfully found entry: Entry(Message(Message { id: Identifier { name: "simple-arg" }, value: Some(Pattern { elements: [TextElement("Hello "), Placeable(InlineExpression(VariableReference { id: Identifier { name: "name" } }))] }), attributes: [], comment: None }))
Successfully found entry: Entry(Message(Message { id: Identifier { name: "multiline-message" }, value: Some(Pattern { elements: [TextElement("Hello this is"), TextElement("\n"), TextElement("a multiline message"), TextElement("\n"), TextElement("using fluent.")] }), attributes: [], comment: None }))
Error: Could not find entry matching id `multiline-message-selector`

As you can see, it managed to find all the entries, except the multiline-message-selector, which had earlier triggered a ParseError.

fluent-multiline-bug's People

Contributors

kellpossible avatar

Watchers

 avatar  avatar  avatar

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.