[stringtemplate-interest] Stringtemplate Attribute
Fantayeneh Asres Gizaw
fantayeneh at gmail.com
Tue Nov 3 03:35:52 PST 2009
I have the following case.
st.setAttribute("x.y.z", "value");
How Can i access this property in st file.
i tried:
$x.y.z$
$("x.y.z")$
Fanta
On 2 Nov 2009, at 19:50, stringtemplate-interest-request at antlr.org
wrote:
> Send stringtemplate-interest mailing list submissions to
> stringtemplate-interest at antlr.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
> or, via email, send a message with subject or body 'help' to
> stringtemplate-interest-request at antlr.org
>
> You can reach the person managing the list at
> stringtemplate-interest-owner at antlr.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of stringtemplate-interest digest..."
>
>
> Today's Topics:
>
> 1. Re: Web app - read templates from multiple directories
> (Terence Parr)
> 2. Re: Web app - read templates from multiple directories
> (Ran Tavory)
> 3. StringTemplate struts2 support (Ran Tavory)
> 4. Re: Multivalued attributes and iteration over inner and outer
> loops (Ollerton, Robert M CIV SPAWARSYSCEN-PACIFIC, 71120)
> 5. C# port binaries (CSharp3 target, StringTemplate, Tool,
> MSBuild integration) (Sam Harwell)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 1 Nov 2009 18:06:31 +0900
> From: Terence Parr <parrt at cs.usfca.edu>
> Subject: Re: [stringtemplate-interest] Web app - read templates from
> multiple directories
> To: Ran Tavory <rantav at gmail.com>
> Cc: stringtemplate-interest at antlr.org
> Message-ID: <5DA84FC5-5B70-42AC-B8FF-8081782BF56E at cs.usfca.edu>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
> On Nov 1, 2009, at 5:49 PM, Ran Tavory wrote:
>
>> I've implemented a string template result type for struts2, and so
>> far I'm very happy with st, but there's one limitation I haven't
>> been able to figure out.
>> It seems ST requires all template files to be at the same directory.
>> (or did I miss anything?...)
>> So, for medium to large web-apps this is an annoyance. I'd like to
>> be able to create multiple directories, such as "full_pages" or
>> "layouts" or "snippets" or "reports" and be able to load
>> multiple .st files from their common parent directory.
>>
>> Is there a way to get over this limitation?
>
> Use subdirectories and then use $misc/searchbox()$ and $gutter/
> leftnav()$ etc :)
>
> Ter
>
>
> ------------------------------
>
> Message: 2
> Date: Sun, 1 Nov 2009 17:03:36 +0200
> From: Ran Tavory <rantav at gmail.com>
> Subject: Re: [stringtemplate-interest] Web app - read templates from
> multiple directories
> To: Terence Parr <parrt at cs.usfca.edu>
> Cc: stringtemplate-interest at antlr.org
> Message-ID:
> <e4b4609b0911010703sf462e9dv6810dd24d1a7dfd4 at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Ah, that simple, thanks!
>
> On Sun, Nov 1, 2009 at 11:06 AM, Terence Parr <parrt at cs.usfca.edu>
> wrote:
>
>>
>> On Nov 1, 2009, at 5:49 PM, Ran Tavory wrote:
>>
>> I've implemented a string template result type for struts2, and so
>> far I'm
>>> very happy with st, but there's one limitation I haven't been able
>>> to figure
>>> out.
>>> It seems ST requires all template files to be at the same
>>> directory. (or
>>> did I miss anything?...)
>>> So, for medium to large web-apps this is an annoyance. I'd like to
>>> be able
>>> to create multiple directories, such as "full_pages" or "layouts" or
>>> "snippets" or "reports" and be able to load multiple .st files
>>> from their
>>> common parent directory.
>>>
>>> Is there a way to get over this limitation?
>>>
>>
>> Use subdirectories and then use $misc/searchbox()$ and $gutter/
>> leftnav()$
>> etc :)
>>
>> Ter
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20091101/390d26e4/attachment-0001.html
>
> ------------------------------
>
> Message: 3
> Date: Mon, 2 Nov 2009 16:05:04 +0200
> From: Ran Tavory <rantav at gmail.com>
> Subject: [stringtemplate-interest] StringTemplate struts2 support
> To: stringtemplate-interest at antlr.org
> Message-ID:
> <e4b4609b0911020605t2128c729oce56d59c7c867cc1 at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I've implemented struts2 support for StringTemplate if anyone is
> interested.
> It's still "unstable" (just wrote it last week) - there are no
> issues, it's
> just new, so not yet heavily tested.
> http://rantav.posterous.com/struts2-stringtemplate-support
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20091102/a83da8bb/attachment-0001.html
>
> ------------------------------
>
> Message: 4
> Date: Mon, 2 Nov 2009 06:41:43 -0800
> From: "Ollerton, Robert M CIV SPAWARSYSCEN-PACIFIC, 71120"
> <bob.ollerton at navy.mil>
> Subject: Re: [stringtemplate-interest] Multivalued attributes and
> iteration over inner and outer loops
> To: <stringtemplate-interest at antlr.org>
> Message-ID:
> <FBE48BFEFDEF4E41AC92A4BF7B8886896E725F at nawespscez02v.nadsuswe.nads.navy.mil
> >
>
> Content-Type: text/plain; charset="us-ascii"
>
>> .Message: 1
>> Date: Thu, 29 Oct 2009 12:13:11 -0800
>> From: "Ollerton, Robert M CIV SPAWARSYSCEN-PACIFIC,
> 71120"<bob.ollerton at navy.mil>
>> Subject: [stringtemplate-interest] Multivalued attributes and
>> iteration
> over inner and outer loops
>> To: <stringtemplate-interest at antlr.org>
>> Message-ID:
>
>> <FBE48BFEFDEF4E41AC92A4BF7B8886896E725E at nawespscez02v.nadsuswe.nads.nav
> y.mil>
>>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> Greetings,
>>
>> I do not understand how to formulate a group of templates that can be
> used to iterate over the elements in lists of lists. I would like to
> understand how to use string templates generate the same output that
> this program does. For example, the following program generates this
> output when given 2 and 3 as inputs:
>>
>> s0
>> e0 -> s0
>> e1 -> s1
>> e2 -> s0
>> s1
>> e0 -> s0
>> e1 -> s1
>> e2 -> s0
>>
>> What would a set of templates, preferably in a single group template
> file, look like?
>>
>> Thanks,
>> Bob
>>
>> /**
>> * The program
>> */
>> class S {
>> final String s;
>> final T[] t;
>>
>> S(String s, int n) { this.s = s; t = new T[n]; }
>> public String getS() { return s; }
>> public T[] getT() { return t; }
>>
>> public String toString(){
>> StringBuilder sb = new StringBuilder();
>> sb.append(s);
>> for (T temp: t)
>> sb.append("\n " + temp.getE()+ " -> " + temp.getD());
>> return sb.toString();
>> }
>> }
>> class T {
>> final String e;
>> final String d;
>>
>> T(String e, String d) { this.e = e; this.d = d; }
>> public String getD() { return d; }
>> public String getE() { return e; }
>> }
>> public class Test {
>> public static void main(String[] args) {
>> final int j = Integer.parseInt(args[0]);
>> final int k = Integer.parseInt(args[1]);
>> S[] s = new S[j];
>> for (int outer = 0; outer < j; outer++) {
>> s[outer] = new S("s" + outer, k);
>> for (int inner = 0; inner < k; inner++) {
>> s[outer].getT()[inner] = new T("e" + inner, "s"
>> + (inner % j));
>> }
>> }
>>
>> for (S v: s)
>> System.out.println(v.toString());
>> }
>> }
>>
> ---------------------------------------------------------
>
> This group file does it for the following program:
>
> ---------------------------------------------------------
> group test;
>
> event_case(e, s) ::= <<
> case <e>:
> <s>Action(data);
>>>
>
>
> event_switch (trans) ::=
> <<<trans:event_case(e=trans.e, s=trans.d)> >>
>
> state_case (states) ::= <<
> case <it.s> :
> switch (event) {
> <it.t:event_switch(); separator="\n">
> default:
> break;
> }
>>>
>
> state_switch (states)::= <<
>
> switch (current) {
> <states:state_case(); separator="\n">
> default:
> break;
> }
>>>
>
> ---------------------------------------------------------
> import java.io.FileReader;
> import java.io.IOException;
> import org.antlr.stringtemplate.StringTemplate;
> import org.antlr.stringtemplate.StringTemplateGroup;
> class S {
> final String s;
> final T[] t;
>
> S(String s, int n) {
> this.s = s;
> t = new T[n];
> }
>
> public String getS() {
> return s;
> }
>
> public T[] getT() {
> return t;
> }
>
> public String toString() {
> StringBuilder sb = new StringBuilder();
> sb.append(s);
> for (T temp : t)
> sb.append("\n " + temp.getE() + " -> " + temp.getD());
> return sb.toString();
> }
> }
> class T {
> final String e;
> final String d;
>
> T(String e, String d) {
> this.e = e;
> this.d = d;
> }
>
> public String getD() {
> return d;
> }
>
> public String getE() {
> return e;
> }
>
> public String toString(){
> return e + "->" + d;
> }
> }
> public class Test {
> //
> public static void main(String[] args) throws IOException {
> final int j = Integer.parseInt(args[0]);
> final int k = Integer.parseInt(args[1]);
> S[] s = new S[j];
> for (int outer = 0; outer < j; outer++) {
> s[outer] = new S("s" + outer, k);
> for (int inner = 0; inner < k; inner++) {
> s[outer].getT()[inner] = new T("e" + inner, "s"
> + (inner % j));
> }
> }
> for (S v : s)
> System.out.println(v.toString());
> //
> final String filename = "templates/test.stg";
> final FileReader reader = new FileReader(filename);
> StringTemplateGroup group = new StringTemplateGroup(reader);
> reader.close();
> // final StringTemplate template = group.getInstanceOf("ev");
> final StringTemplate template = group
> .getInstanceOf("state_switch");
> template.setAttribute("states", s);
> System.out.println(template.toString());
> }
> }
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 2 Nov 2009 13:49:53 -0600
> From: "Sam Harwell" <sharwell at pixelminegames.com>
> Subject: [stringtemplate-interest] C# port binaries (CSharp3 target,
> StringTemplate, Tool, MSBuild integration)
> To: <antlr-dev at antlr.org>, <antlr-interest at antlr.org>, "StringTemplate
> Mailing List" <stringtemplate-interest at antlr.org>
> Message-ID:
> <DD5A5D428FE040429CCDF377FAA892840152DE08 at martini.ironwillgames.com>
> Content-Type: text/plain; charset="us-ascii"
>
> I've made some fixes since my previous release, so I'm releasing an
> updated beta build. I'm very interested in any feedback you may have
> about any part of this.
>
>
>
> http://www.280z28.org/downloads/antlr-dotnet-binaries-3.2.0.6288.7z
>
>
>
> Since this is hosted on a different site than the original, you can
> check the assembly strong names to verify that I built this one with
> the
> same in-house signing keys as the earlier release. :)
>
>
>
> Contents:
>
>
>
> * LICENSE.txt. All code in the C# ports of the Tool and
> StringTemplate, plus the CSharp3 target are licensed under the same
> BSD
> 3-clause license as their Java counterparts except for the addition of
> my name. Other targets are licensed under their own terms so you'll
> have
> to check those separately if they are relevant to you.
>
> * CSharp3 runtime (Antlr3.Runtime.dll and
> Antlr3.Runtime.Debug.dll). You always have to reference
> Antlr3.Runtime.dll to use the CSharp3 target. You only need to
> reference
> Antlr3.Runtime.Debug.dll if you build with the -debug or -profile
> command line flags.
>
> * StringTemplate .NET port (Antlr3.StringTemplate.dll). This
> depends on both of the CSharp3 runtime DLL's, so include those if you
> are using StringTemplate.
>
> * ANTLR Tool .NET port (Antlr3.exe). Works with the same
> command
> line arguments as the Java version, and should produce nearly
> identical
> output for any given target. All target code generation templates are
> updated to the latest version as of earlier today.
>
> * MSBuild integration (Antlr3.targets, AntlrBuildTask.dll).
> Preliminary instructions for using this follows.
>
> * Symbol files for all binaries (*.pdb).
>
>
>
> MSBuild Integration Instructions:
>
>
>
> These instructions definitely work for Visual Studio 2008 C# projects
> targeting the CSharp3 runtime (it's how I built all the files you're
> downloading). They almost surely work for the CSharp2 target, but I
> haven't tried it. They might also work for Visual Studio 2005 or 2010
> projects, but again I haven't tried it.
>
>
>
> Extract the contents of the download to $(SolutionDir)\external\antlr.
> For example, if you have the solution file C:\Something\MyProject.sln,
> then you would find Antlr3.exe at
> C:\Something\external\antlr\tool\Antlr3.exe. (The directions can be
> modified to suit if you want to use a different path.)
>
>
>
> Open your project file (*.csproj) as an XML or plain text file and
> locate the line importing Microsoft.CSharp.targets. I've included the
> line in the following block of code as a reference point for the
> necessary changes - just add the other lines below that point.
>
>
>
> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
>
> <!-- Include the following immediately *after* the above import
> (which
> will already exist in the file) -->
>
> <PropertyGroup>
>
> <!-- Folder containing AntlrBuildTask.dll -->
>
>
> <AntlrBuildTaskPath>$(SolutionDir)external\antlr\msbuild</
> AntlrBuildTask
> Path>
>
> <!-- Path to the ANTLR Tool itself. -->
>
>
> <AntlrToolPath>$(SolutionDir)external\antlr\tool\Antlr3.exe</
> AntlrToolPa
> th>
>
> </PropertyGroup>
>
> <Import Project="$(SolutionDir)external\antlr\msbuild\Antlr3.targets"
> />
>
>
>
> When you open the project in Visual Studio, you will be able to
> select a
> .g or .g3 file in the project, select right click > Properties, and
> choose Antlr3 as the Build Action. To add a new grammar to the
> project,
> add a new "Text File" with the extension .g or .g3, and set its build
> action. You no longer have to manually add grammars by editing the
> project file.
>
>
>
> Finally, make sure you add a reference to the appropriate ANTLR
> runtime
> (CSharp2 or CSharp3).
>
>
>
> Thank you,
>
> Sam Harwell
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20091102/f6323352/attachment.html
>
> ------------------------------
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
>
>
> End of stringtemplate-interest Digest, Vol 56, Issue 2
> ******************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20091103/72476401/attachment-0001.html
More information about the stringtemplate-interest
mailing list