Giter Site home page Giter Site logo

Comments (6)

parrt avatar parrt commented on July 28, 2024

try field not field=field

from stringtemplate4.

phreed avatar phreed commented on July 28, 2024

That works.
Similarly

auxMap ::= [
   "E": "electric <field>",
   "I": "in <field> between",
   "F": "<field> force",
   default: "<field>"
]

makeTmpl(type, field) ::= <<
<auxMap.(type)>
>>

top ::= <<
  <makeTmpl("E", "foo")>
  <makeTmpl("F", "foo")>
  <makeTmpl("I", "foo")>
>>

Would previously result in...

electric foo
foo force
in foo between

Now this produces three blank lines.
Is this the correct behavior?
I'm guessing it is deprecated.

from stringtemplate4.

parrt avatar parrt commented on July 28, 2024

I'll have to look into that one. should work.

from stringtemplate4.

sharwell avatar sharwell commented on July 28, 2024

What happens if you use the following dictionary?

auxMap ::= [
   "E": {electric <field>},
   "I": {in <field> between},
   "F": {<field> force},
   default: {<field>}
]

from stringtemplate4.

phreed avatar phreed commented on July 28, 2024

Yes, that works.
The new syntax makes more sense, it looks more like a dictionary of anonymous templates (and not just a bunch of strings).
I guess these aren't bugs, just operator error (or maybe a soft spot in the documentation?).
As relating to documentation I noticed that in some cases the '}' needs to be escaped in v4.
e.g.

<foo: { bar |  then we put in some source containing \} that needs escaping }; separator="," >

Thanks

from stringtemplate4.

parrt avatar parrt commented on July 28, 2024
top ::= <<...

should be

top() ::= <<...

As indicated by the reported error message:

t.stg 12:0: garbled template definition starting at 'top'

With that in place, the expected (and actual) text output is:

  electric <field>
  <field> force
  in <field> between

from stringtemplate4.

Related Issues (20)

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.