FAQ Database Discussion Community


Match string in XText regardless of upper/lower case

java,eclipse,pattern-matching,dsl,xtext
I want to create a rule in XText that matches to a string, but does not care in what case the string is. For example, I want it to match against both "DUCK", "DucK" and "duck". Is there a more simple way of doing it than covering all cases, like:...

Allowing only one command perline in DSL

dsl,xtext
In my grammar I want atmost one command per line (I dont want ';' or ':' to terminate my commands). But when I use ('\r'?'\n') to ensure one command per line, it produces an extra line gape. for example it produces: read Ram 03DF write Ram 05FF JMP Add 056A...

how to fix a simple error on xtext?

eclipse,compiler-errors,uml,dsl,xtext
this is my example to show you the problem I need to call two rules generate umlDsl "http://www.xtext.org/example/umldsl/UmlDsl" Model: elements+=rule* ; rule: rul1 'and' rul2 ; rul1: 'rul1' action1=[uml::Action|FQN] ; rul2: 'rul2' action2=[uml::Action|FQN] ; FQN returns ecore::EString: ID ("." ID)* ; I have this error Multiple markers at this line...

FParsec parses only first half

parsing,f#,dsl,fparsec
In my AST, I have something like this: type Program = Declaration list and Declaration = | TypedefDeclaration of TypedefDeclaration and TypedefDeclaration = | Typedef1 of Name * TypeName | Typedef2 of Name * Name For parsing both of the statements, I have used something like this: let tdefpartial =...

Writing Custom methods in Java DSL for apache camel routes

java,apache-camel,dsl
Can i write my own Processor Definition methods in Camel and use that in my route as below ? from(uri) .to("http://host:port/testData") .**setTimeOut(long milliseconds)** from is implemented in RouteDefinition and to is implemented in ProcessorDefinition. Like that if i want to implement setTimeOut method and use it in java DSL, how...

How to structure my XText terminals? WORDS/SL_STRING/ML_STRING

java,eclipse,eclipse-plugin,dsl,xtext
In my XText DSL, I want to be able to use three different kinds of text terminals. They are all used for adding comments on top of arrows drawn in a UML diagram: terminal WORD: Actor -> Actor: WORD terminal SL_STRINGS: Actor -> Actor: A sequence of words on a...

Need to extract the timestamp from a logstash elasticsearch cluster

json,parsing,elasticsearch,logstash,dsl
I'm trying to determine the freshness of the most recent record in my logstash cluster, but I'm having a bit of trouble digesting the Elasticsearch DSL. Right now I am doing something like this to extract the timestamp: curl -sX GET 'http://localhost:9200/logstash-2015.06.02/' -d'{"query": {"match_all": {} } }' | json_pp |...

Having Geany support syntax highlighting for my DSL

syntax-highlighting,dsl,geany
For the DSL I have developed, I wanted to have Geany support it as it does the embedded languages like java and C#. I created filetypes.myLang.conf and added the configuration fields as in the manual. For the filed [settings] I added : lexer_filetype=C Now everything seems fine. My language comes...

How do I use a @Transformer bean with Spring Integration Java DSL?

spring-integration,dsl
I'd like to use a bean with a method annotated with @Transformer to transform a message accessing part of its headers with the @Header annotation. Is there a way to do this with the Java DSL (with Java 7, so no lambdas)? It does not seem like so.

Groovy DSL: How can I let two delegating classes handle different parts of a DSLScript?

groovy,dsl
Let's say I have a DSL like this setup {name = "aDSLScript"} println "this is common groovy code" doStuff {println "I'm doing dsl stuff"} One would have a delegating class implementing the methods 'setup' and 'doStuff' usually. Beside, one could write common Groovy code to be executed (println...). What I...

Why can an instance of a class access private fields of another instance of its own type?

java,semantics,dsl
An instance of a class, in Java, can access private fields of a different instance of its own type, such as in the following listing: public class Foo { private int secret; public void bar(final Foo foo) { foo.secret = 100; } } What would be the argument for such...

Java DSL implementation using ANTLRv4

java,parsing,antlr,grammar,dsl
So, due to the assignment I was given, I've ended up wondering around what actually the next step might be. To clarify things, I am supposed to implement a DSL language by using Java. The language should enable the "user" the specify and create questionnaire forms based of course on...

Copy block constants into module

ruby,module,dsl
I am trying to define a DSL where some constants are defined within a block and must be copied into a fresh made module. I got this so far: class Foo def self.macros(&block) mod = Module.new do module_eval &block end self.const_set(:Macros, mod) end macros do Point = Struct.new :x, :y...

Boost.Proto : How to make an expression terminal of a primitive array instead of std::vector?

c++,dsl,template-meta-programming,expression-templates,boost-proto
Now I am trying to make yet another mini-EDSL (embedded domain-specific language) for vector expressions. Actually Boost.Proto users' guide already provided such an EDSL example, "Lazy Vector", where vector expressions are made of std::vector<T>. But I have to make those expressions of primitive arrays instead. Because primitive array operation is...

How to create a camel route that references a specific Java method?

java,apache-camel,dsl
I want to write a Camel route that reads all xml files in a specific directory, then calls a process Java method of a class that implements Processor to do something and print the result to screen. For example the Java class is named ScriptProcessor, and it has a process...

AutoCompletion for my DSL keywords in Geany

autocomplete,ide,dsl,geany
Geany(IDE) supports Autocompletion or IntelliSense as you program, but this is done based on the words you've used in the code so far. Is there any way so I could have Autocompletion for my language keywords?...

Scala: store call-by-name variable as class field

scala,dsl,callbyname
In my progress in Scala learning I try to implement a simple DSL with callbacks object Button {...} // apply class Button(val name: String) { private val: => Unit; // doesn't work def click(f: => Unit) = { _click_cb = f this } def onClick() = this._click_cb() } Button("Click me!")...

How to declare Module in Page to use IDE autocompletion In GEB?

autocomplete,dsl,geb,strong-typing,pageobjects
According to http://www.gebish.org/manual/current/modules.html#modules Modules should be defined like this: class ExamplePage extends Page { static content = { theModule { module ExampleModule } } } From Geb's Documentation: 16.2.2 Strong typing In order to gain improved authoring support, you must include types in your tests and page objects. Additionally, you...

Xtext grammar : mismatched input '0' expecting RULE_INT

grammar,dsl,xtext,ecore
I'm new to Xtext and I'm trying to create a simple DSL for railway systems, here's my grammar : grammar org.xtext.railway.RailWay with org.eclipse.xtext.common.Terminals generate railWay "http://www.xtext.org/railway/RailWay" Model: (trains+=Train)* | (paths+=Path)* | (sections+=Section)* ; Train: 'Train' name=ID ':' 'Path' path=[Path] 'Speed' speed=INT 'end' ; Path: 'Path' name=ID ':' 'Sections' ('{' sections+=[Section]...

Is it possible to define a custom parser and AST for quotations in F#?

f#,dsl
Is it possible to define a custom parser and AST for quotations in F#? Specifically, the code open Microsoft.FSharp.Quotations let e = <@ 1+1 @> Generates val e : Expr<int> = Call (None, op_Addition, [Value (1), Value (1)]) I would like to instead do two things. One, I would like...

shift/reduce and reduce/reduce errors in F# using fsyacc and fslex

parsing,f#,dsl,lexer,fsyacc
I'm creating my own external DSL, which I intend to be pretty small and include some basic functionality. When I compile my project, it builds successfully but it shows a lot of shift/reduce and reduce/reduce errors. And most of them are around my binary operators. Here is part of my...

Convert Hibernate @Formula to JOOQ field

sql,hibernate,jpa,dsl,jooq
I am rewriting entire DB access layer from Hibernate to JOOQ and I face following issue. One of JPA models is annotated with @Formula annotation as follows: @Formula("fee1 + fee2 + fee3 + fee4") private BigDecimal fee5; Later in the code, a JPA query is made against the database which...

How do I do nested parenthesis in antlr4?

nested,grammar,dsl,antlr4,nested-lists
I have the following grammar query : unquoted_str+ | '(' query ')' ; unquoted_str : UNQUOTED_STR ; UNQUOTED_STR : [A-Za-z_][A-Za-z0-9_-]* ; WS : [ \t\r\n]+ -> skip ; I want to be able to execute the following query: abc (def (hij)) But I keep getting the error: line 1:4 extraneous...

Split xml file in camel using the .split().tokenizeXML()?

java,xml,split,apache-camel,dsl
How to Split xml file in camel using the .split().tokenizeXML()? I have attached the code snippet. I dont know where I did mistake. Here is my input. <Record> <DataFile xmlns="Created"> </DataFile> <DataFile xmlns="Updated"> </DataFile> <DataFile xmlns="Deleted"> </DataFile> </Record> Here is my camel route // Main Route from(...) .routeId("processor route") .process(...)...

Elasticsearch the terms filter raise “filter does not support [mediatest]”

json,elasticsearch,dsl
my query is like this: { "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "online": 1 } }, { "terms": { "mediaType": "flash" } } ] } } } } } it raise a QueryParsingException [[comos_v2] [terms] filter does not support [mediaType]],of which the field...

How does Cucumber DSL work?

ruby,cucumber,dsl,internal
Let's take: When /^(?:|I )fill in the following:$/ do |fields| fields.rows_hash.each do |name, value| When %{I fill in "#{name}" with "#{value}"} end end With my rudimentary Ruby knowledge, I was thinking that When is a method call that takes a regular expression and a block. But then, I am also...

Xtext serializer generates not valid DSL

serialization,dsl,xtext
I have DSL instances and I'm trying to serialize them. I have the following grammar: Database returns schema::Database: 'database' name=EString '{' (keys+=Key ( "," keys+=Key)*)? ) ('structures''{' structureList+=(Group|Template)(','structureList+=(Group|Template))* '}')? '}' ; Group returns schema::Group: structureType=StructureType name=EString ('{' ('table' '{' tableFieldList=FieldList '}')?) '}') ; First of all the serializer ignores the...

Logic OR in a DSL

drools,dsl,rules
I have a question around how to do an or in a DSLR, I have this rule: rule "Test" when There is AThing - with attribute1 is equal to something1 - attribute2 is higher than or equal to somethingelse1 There is AThing - with attribute1 is equal to something2 -...

Dynamically changing functions scala

scala,recursion,dsl,callbyname
I'm learning scala and I have come across the following code. def whileLoop(cond: => Boolean)(body: => Unit): Unit = if (cond) { body whileLoop(cond)(body) } var i = 10 whileLoop (i > 0) { println(i) i -= 1 } The output is the numbers 10 to 1. So both cond...