I use antlr4 grammar is mysql-workbench.
https://github.com/mysql/mysql-workbench/tree/8.0/library/parsers/grammars
The cmd as follows
java -Xmx1024m -jar antlr4-4.7.2.jar -Dlanguage=CSharp -listener -visitor -o ./mysql -package MyAntlr4 MySQLLexer.g4 MySQLParser.g4
However,I miss the class MySQLBaseLexer, MySQLBaseRecognizer. How can I get the Class file。
These classes exist only in C++. You have to port them over to C# yourself. However, they are only support classes for a few things like predicates, server version etc. So, it should be fairly easy to do the translation. Also, it would be enough to only port the necessary parts. Not every helper function in those classes is required to use the MySQL grammar.
Related
I am developing Haxe code that I convert in C# and insert into a Unity project.
The conversion works fine and I am able to use the generated class when I import it alone in Unity.
To make it work, I have to bring in Unity the whole generated src folder, including the Type.cs file.
However, when I import the "Post Processing Stack" (a basic Unity extension) I get errors due to name Conflicts. The Type class is also a basic C# class and It is used by the Post Processing scripts.
The haxe-Type takes priority and breaks the compilation:
Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs(406,30): error CS1502: The best overloaded method match for `System.Collections.Generic.Dictionary<Type,System.Collections.Generic.KeyValuePair<UnityEngine.Rendering.CameraEvent,UnityEngine.Rendering.CommandBuffer>>.Add(Type, System.Collections.Generic.KeyValuePair<UnityEngine.Rendering.CameraEvent,UnityEngine.Rendering.CommandBuffer>)' has some invalid arguments
Assets/PostProcessing/Runtime/PostProcessingBehaviour.cs(406,34): error CS1503: Argument `#1' cannot convert `System.Type' expression to type `Type'
I don't know if it is possible to solve this issue by playing around with C#/Unity/Mono search paths.
I as wondering wether it is more appropriate to (optionally) wrap all haxe top-level classes into the haxe namespace, or a special haxe-defaultnamespace, or prefix them for example to class HType.
Name conflicts for this basic types are likely to emerge in many other contexts, not only in Unity.
I found the solution in the Haxe documentation for C#:
https://github.com/HaxeFoundation/HaxeManual/wiki/Haxe-C%23
-D no-root generate package-less haxe types in the haxe.root namespace to avoid conflicts with other types in the root namespace
This way, all the classes that were at global level will be generated under namespace haxe.root.
I'd like to use the NativeJSON class from a Rhino shell script. The only things I can find about how to use it on the Web are from Java.
// Load the configuration file
load(arguments[0]);
// Extract the configuration for the target environment
print(NativeJSON.stringify(environments[arguments[1]]));
Any clue how I'd get at it from a Rhino shell script?
The NativeJSON class is an implementation of the JSON object from ECMAScript 5, so you shouldn't need to do anything special. You can access it by calling JSON.stringify(object) or JSON.parse(jsonString).
So, I have an app where users should define ActionScript functions.
What do I need to get the string whritten by the user and convert it to bytecode so that I can use it with as3-commons-bytecode?
Edit
I don't think I was clear enough. I need to turn: if(!myValue) {...}
Into this:
...
findpropstrict private::myValue
getproperty private::myValue
not
iffalse L1
...
Because with this ^^^^ code, I can use as3-commons-bytecode to do what I need.
I took a look at this app's source code. It's very confusing, the project is old and the code is a mess, but it works. I need to find "where the magic happens". Can you show me the way?
You should use part of this project :
eval.hurlant.com/demo/#app=da4a&757d-selectedIndex=0
Check source , there is parser to ABC .
I'm not aware of any libraries that do this for you, but to achieve this functionality you should parse user's input into function names.
For example, you can call a function just by having it's name as a String like so:
var functionName:String = "myMethod";
function myMethod():void
{
trace("myMethod");
}
this[functionName](); //traces "myMethod"
Of course, if you wish to interpret advanced strings with getting/setting objects and their properties and any other user defined statements, that would require to write quite a sophisticated string-to-bytecode converter.
UPDATE:
There's also AS3Eval library that might do the job. Take a look at http://eval.hurlant.com/
There is a library for Haxe which makes it possible to compile Actionscript assembly language into ABC at runtime, but this is still lower-level than the Actionscript you normally write.
http://haxe.org/com/libs/format/abc
The most likely solution is a server or other process which can compile and return SWF content for you. Haxe has a very fast and straightforward compiler, but it may also be possible to use Tamarin or another solution for compiling AS3 on the server.
Actually, there is a runtime library for executing Haxe code, which again, is very similar to Actionscript. Might be worth looking into:
http://code.google.com/p/hscript/
What exactly want to do? To compile "string" the string must be something meanfull for the compiler such as package not a simply string ( like 'asdas ' ). If you don't wont to use flash/flex compiler you may compile AS to ABC with Ant or Haxe. But ther is a problem - how you will start this ABC?
I'm trying to port some java to jruby, and it uses a beans PropertyDescriptor. The original code is:
new PropertyDescriptor("splitEvaluator", CrossValidationResultProducer.class)
which I've tried to port to:
PropertyDescriptor.new("splitEvaluator", CrossValidationResultProducer)
However, I get the error:
no constructor with arguments matching [class org.jruby.RubyString, class org.jruby.RubyClass] on object #<Java::JavaBeans::PropertyDescriptor:0x86f847> (NameError)
The PropertyDescriptor API says the second argument should be a Java Class. What do I need to pass for this to work in JRuby?
I can see an argument that it's a bug that it doesn't work the way you originally expected. Or at least that JRuby would be smart enough to convert a Ruby class representation of a Java class to a Java class argument.
As it is, using #java_class works, as you found out.
I need to use the Java class, rather than the Ruby representation of the Java class. This works.
PropertyDescriptor.new("splitEvaluator", CrossValidationResultProducer.java_class)
What is an alternative to autotools in Haskell world? I want to be able to choose between different configurations of the same source code.
For example, there are at least two implementations of MD5 in Haskell: Data.Digest.OpenSSL.MD5 and Data.Digest.Pure.MD5. I'd like to write code in such a way that it can figure out which library is already installed, and didn't require to install the other.
In C I can use Autotools/Scons/CMake + cpp. In Python I can catch ImportError. Which tools should I use in Haskell?
In Haskell you use Cabal configurations. At your project top-level directory, you put a file with the extension .cabal, e.g., <yourprojectname>.cabal. The contents are roughly:
Name: myfancypackage
Version: 0.0
Description: myfancypackage
License: BSD3
License-file: LICENSE
Author: John Doe
Maintainer: john#example.com
Build-Type: Simple
Cabal-Version: >=1.4
Flag pure-haskell-md5
Description: Choose the purely Haskell MD5 implementation
Default: False
Executable haq
Main-is: Haq.hs
Build-Depends: base-4.*
if flag(pure-haskell-md5)
Build-Depends: pureMD5-0.2.*
else
Build-Depends: hopenssl-1.1.*
The Cabal documentation has more details, in particular the section on Configurations.
As nominolo says, Cabal is the tool to use. In particular, the 'configurations" syntax.