I have tried to execute the below grammar. But, it is throwing an error.
Phase: SvP_updates_featuretype
Input: Macro_Requirement updates_KW
Options: control = appelt debug = true
Rule: updates_featuretype
Priority:20
(
(Macro_Requirement contains updates_KW)
)
:updates_featuretypeFired
-->
:updates_featuretypeFired.Macro_Requirement_updates = {category = "Macro_Requirement_updates", rule = "updates_featuretype"}
Error:
gate.creole.ResourceInstantiationException: Error while parsing the grammar (file:/C:/Users/Singo/Dropbox/Gayatri%20Kumari%20Damarasingu/Identification%20Stage%20Resources/GATE-Resources/Processing_resources/main_POSTINGAPPROACH.jape):
at gate.creole.Transducer.init(Transducer.java:127)
at gate.creole.AbstractProcessingResource.reInit(AbstractProcessingResource.java:65)
at gate.gui.NameBearerHandle$ReloadAction$1.run(NameBearerHandle.java:1456)
at java.lang.Thread.run(Thread.java:745)
Caused by: gate.jape.JapeException: Batch: error parsing transducer: Cannot parse a phase in file:/C:/Users/Singo/Dropbox/Gayatri%20Kumari%20Damarasingu/Identification%20Stage%20Resources/GATE-Resources/Processing_resources/SvP/SvP_database_featuretype.jape: file:/C:/Users/Singo/Dropbox/Gayatri%20Kumari%20Damarasingu/Identification%20Stage%20Resources/GATE-Resources/Processing_resources/SvP/SvP_database_featuretype.jape:22:2: unknown macro name Macro_Requirement
at gate.jape.Batch.parseJape(Batch.java:175)
at gate.jape.Batch.<init>(Batch.java:101)
at gate.creole.Transducer.init(Transducer.java:109)
... 3 more
Could not able to figure out how come the macro name Macro_requirement is not correct here. Can someone please help me in this
You forgot curly braces around Macro Requirement contains updates KW:
Phase: SvP_updates_featuretype
Input: Macro_Requirement updates_KW
Options: control = appelt debug = true
Rule: updates_featuretype
Priority:20
(
({Macro_Requirement contains updates_KW})
)
:updates_featuretypeFired
-->
:updates_featuretypeFired.Macro_Requirement_updates = {category = "Macro_Requirement_updates", rule = "updates_featuretype"}
Related
#bazel_skylib//rules:native_binary.bzl defines the native_binary rule which can be used to wrap native executables inside a bazel target. I used it to wrap a packaging tool called packfolder.exe from the Sciter SDK.
I placed the binary into my source tree at third_party/sciter/packfolder.exe and wrote this BUILD file.
# third_party/sciter/BUILD
native_binary(name = "packfolder",
src = "packfolder.exe",
out = "packfolder.exe"
)
bazel run third_party/sciter:packfolder runs with no issues. Now I want to use this target inside my custom cc_sciter_resource rule.
# third_party/sciter/sciter_rules.bzl
def _impl(ctx):
in_files = ctx.files.srcs
output_file = ctx.actions.declare_file(ctx.label.name)
ctx.actions.run(
outputs = [output_file],
inputs = in_files,
arguments = [],
executable = ctx.executable.packfolder.path)
return DefaultInfo(files = depset([output_file]))
cc_sciter_resource = rule(
implementation = _impl,
attrs = {
"srcs": attr.label_list(),
"packfolder": attr.label(
default = Label("//third_party/sciter:packfolder"),
executable = True,
cfg = "exec"
),
}
)
The trouble is, when I try to build a target that uses this rule, say
cc_sciter_resource(
name = "hello_world_resource.cpp"
srcs = [...]
)
I get the following error.
ERROR: C:/users/marki/sciter-bazel/examples/BUILD:12:19: Action examples/hello_world_resource.cpp failed (Exit -1): packfolder.exe failed: error executing command
cd C:/users/marki/_bazel_marki/kiodv2fz/execroot/sciter_bazel
bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/third_party/sciter/packfolder.exe
Execution platform: #local_config_platform//:host. Note: Remote connection/protocol failed with: execution failed
Action failed to execute: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\marki\_bazel_marki\kiodv2fz\execroot\sciter_bazel\bazel-out\x64_windows-opt-exec-2B5CBBC6\bin\third_party\sciter\packfolder.exe"): The system cannot find the file specified.
(error: 2)
Target //examples:hello_world_resource.cpp failed to build
The directory C:\users\marki\_bazel_marki\kiodv2fz\execroot\sciter_bazel\bazel-out\x64_windows-opt-exec-2B5CBBC6 does not exist on my computer. So the error is accurate, but I don't know how to resolve the issue.
--- sciter_rules.bzl
+++ sciter_rules.bzl
## -6,7 +6,7 ##
outputs = [output_file],
inputs = in_files,
arguments = [],
- executable = ctx.executable.packfolder.path)
+ executable = ctx.executable.packfolder)
return DefaultInfo(files = depset([output_file]))
cc_sciter_resource = rule(
ctx.executable.packfolder.path is just a string, so Bazel doesn't know that the packfolder executable needs to be added as an input to the action.
I want to create a learner in mlr3, using the distRforest package.
my code:
library(mlr3extralearners)
create_learner( pkg = "." ,
classname = 'distRforest',
algorithm = 'regression tree',
type = 'regr',
key = 'distRforest',
package = 'distRforest',
caller = 'rpart',
feature_types = c("logical", "integer", "numeric","factor", "ordered"),
predict_types = c('response'),
properties = c("importance", "missings", "multiclass",
"selected_features", "twoclass", "weights"),
references = FALSE,
gh_name = 'CL'
)
gives the following error : Error in sprintf(msg, ...) : too few arguments
in fact, replicating the code in the tutorial https://mlr3book.mlr-org.com/extending-learners.html throws the same error.
Any ideas? Thanks a lot - c
thanks for your interest in extending the mlr3 universe!
Couple of things, firstly the example in the book works fine for me, and secondly your example cannot work because you are including classif properties for a regr learner. As I am unable to reproduce your error it's hard for me to debug what's going wrong, it would be helpful if you could run the following:
reprex::reprex({
create_learner(
pkg = ".",
classname = "Rpart",
algorithm = "decision tree",
type = "classif",
key = "rpartddf",
package = "rpart",
caller = "rpart",
feature_types = c("logical", "integer", "numeric", "factor", "ordered"),
predict_types = c("response", "prob"),
properties = c("importance", "missings", "multiclass", "selected_features", "twoclass", "weights"),
references = TRUE,
gh_name = "CL"
)
}, si = TRUE)
If you're still getting an error and the output is too long to print here then head over to the GitHub and open an issue there.
I am new to elixir and I need to create ISO 8583 client with this language and Phoenix framework. I found an Erlang library for it from stackoverflow thread here, compiled successfully and followed the example in the repository here but got error when marshaling the message. Here is my Elixir code to marshal the message:
msg1 = :erl8583_message.new()
msg2 = :erl8583_message.set_mti("0800", msg1)
msg3 = :erl8583_message.set(3, "300000", msg2)
msg4 = :erl8583_message.set(24, "045", msg3)
msg5 = :erl8583_message.set(41, "11111111", msg4)
msg6 = :erl8583_message.set(42, "222222222222222", msg5)
msg7 = :erl8583_message.set(63, "This is a Test Message", msg6)
marshalled = :erl8583_marshaller_ascii.marshal(msg7)
That's just an elixir version from the example on the repo. This is the error I've got when running the app:
[error] #PID<0.438.0> running TestlangIsoClientWeb.Endpoint (cowboy_protocol) terminated
Server: 127.0.0.1:4001 (http)
Request: POST /api/process
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in :erl8583_marshaller_ascii.marshal_data_element/2
(erl8583) /home/muhammad/Workspace/testlang/testlang_iso_client/deps/erl8583/src/erl8583_marshaller_ascii.erl:168: :erl8583_marshaller_ascii.marshal_data_element({:n, :fixed, 4}, "0800")
(erl8583) /home/muhammad/Workspace/testlang/testlang_iso_client/deps/erl8583/src/erl8583_marshaller.erl:108: :erl8583_marshaller.marshal/2
(testlang_iso_client) lib/testlang_iso_client_web/controllers/my_controller.ex:61: TestlangIsoClientWeb.MyController.process/2
(testlang_iso_client) lib/testlang_iso_client_web/controllers/my_controller.ex:1: TestlangIsoClientWeb.MyController.action/2
(testlang_iso_client) lib/testlang_iso_client_web/controllers/my_controller.ex:1: TestlangIsoClientWeb.MyController.phoenix_controller_pipeline/2
(testlang_iso_client) lib/testlang_iso_client_web/endpoint.ex:1: TestlangIsoClientWeb.Endpoint.instrument/4
(phoenix) lib/phoenix/router.ex:278: Phoenix.Router.__call__/1
(testlang_iso_client) lib/testlang_iso_client_web/endpoint.ex:1: TestlangIsoClientWeb.Endpoint.plug_builder_call/2
(testlang_iso_client) lib/testlang_iso_client_web/endpoint.ex:1: TestlangIsoClientWeb.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:16: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) /home/muhammad/Workspace/testlang/testlang_iso_client/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
Is there something I missed to make it work? Any help would be very appreciated.
Updated
I have tried to changed the string parameter to charlist, but still got the same error. Here is the code snippet:
def test(conn, _params) do
IO.puts("Test")
msg1 = :erl8583_message.new()
msg2 = :erl8583_message.set_mti('0800', msg1)
msg3 = :erl8583_message.set(3, '300000', msg2)
msg4 = :erl8583_message.set(24, '045', msg3)
msg5 = :erl8583_message.set(41, '11111111', msg4)
msg6 = :erl8583_message.set(42, '222222222222222', msg5)
msg7 = :erl8583_message.set(63, 'This is a Test Message', msg6)
marshalled = :erl8583_marshaller_ascii.marshal(msg7)
json(conn, %{status: "ok"})
end
Here is the function erl8583_marshaller.erl:108 mentioned in the stacktrace:
marshal(Message, MarshalHandlers) ->
OptionsRecord = parse_options(MarshalHandlers, #marshal_options{}),
{Marshalled1, Message1} = init_marshalling(OptionsRecord, Message),
MarshalledMti = encode_mti(OptionsRecord, Message1), % --- Line 108
Marshalled2 = <<Marshalled1/binary, MarshalledMti/binary>>,
{MarshalledBitmap, Message2} = encode_bitmap(OptionsRecord, Message1),
Marshalled3 = <<Marshalled2/binary, MarshalledBitmap/binary>>,
MarshalledFields = encode_fields(OptionsRecord, Message2),
Marshalled4 = <<Marshalled3/binary, MarshalledFields/binary>>,
end_marshalling(OptionsRecord, Message2, Marshalled4).
And here is the function erl8583_marshaller_ascii.erl:168 mentioned in the stacktrace:
%%
%% Local Functions
%%
marshal_data_element({n, llvar, Length}, FieldValue) when length(FieldValue) =< Length ->
erl8583_convert:integer_to_string(length(FieldValue), 2) ++ FieldValue;
I don't understand why the call to that function was failed to match with parameters {:n, :fixed, 4}, "0800" that was sent from my function. I have tried to change the double quotes to single quotes with no success. Is there any other suggestions what am I supposed to do?
there may be a bug in the code.
you can reference this issue here
there is one elixir library out which is relatively new.
its called ale8583.
documentation is still coming out on this one but looks very promising.
you can check it out.
Try passing charlists instead of strings:
msg1 = :erl8583_message.new()
msg2 = :erl8583_message.set_mti('0800', msg1)
msg3 = :erl8583_message.set(3, '300000', msg2)
msg4 = :erl8583_message.set(24, '045', msg3)
msg5 = :erl8583_message.set(41, '11111111', msg4)
msg6 = :erl8583_message.set(42, '222222222222222', msg5)
msg7 = :erl8583_message.set(63, 'This is a Test Message', msg6)
marshalled = :erl8583_marshaller_ascii.marshal(msg7)
There is potential for confusion here:
What Erlang calls "strings" and puts in double quotes ("foo"), Elixir calls "charlists" and puts in single quotes ('foo').
What Elixir calls "strings" and puts in double quotes ("foo"), Erlang calls "binaries" and puts in double quotes plus angle brackets (<<"foo">>).
It seems like the erl8583 library expects Erlang strings throughout.
I have this concrete syntax:
syntax SomeMore = [...] SyncBlock? sync;
syntax SyncBlock = "sync" "{" SyncStatement* stats "}";
syntax SyncStatement = [...];
[SyncBlock]"sync { <syncStrings> }" seems to work, but when I try to use it as a SyncBlock? and assign it:
SyncBlock? sync = [SyncBlock?]"sync { <syncStrings> }"
it does not work: inline parsing not supported on SyncBlock?, what is the easiest way to build up a value of this X?-type?
Can I convert a SyncBlock to a SyncBlock? somehow?
Something like this also doesn’t work:
syncBlock = (SyncBlock?)`sync { <SyncStatement* syncs>}`;
P.S. SyncBlock? syncBlock = … results in Ambiguous code (internal error), SyncBlock? syncBlock = …. Probably due to a ternary operator ambiguity?
I found a workaround, not ideal, but it works.
It seems that the ? in the types introduces some difficulties, but can be circumvented using an "alias" for this type:
I changed the grammar to:
syntax SomeMore = [...] MaybeSyncBlock sync;
syntax MaybeSyncBlock = SyncBlock?;
syntax SyncBlock = "sync" "{" SyncStatement* stats "}";
syntax SyncStatement = [...];
Now this works:
MaybeSyncBlock syncBlock = [MaybeSyncBlock]"sync { <syncStrings> }";
In my Xtext project I want to use quickfix to insert a new line before the current line for the missing cross-reference.But it gives following exception.
!ENTRY org.eclipse.core.jobs 4 2 2015-06-02 17:22:05.616
!MESSAGE An internal error occurred during: "Select and reveal referenced object".
!STACK 0
java.lang.IllegalArgumentException: The feature 'content' is not a valid feature
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eStructuralFeature(BasicEObjectImpl.java:733)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eObjectForURIFragmentSegment(BasicEObjectImpl.java:551)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:766)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:742)
at org.eclipse.xtext.resource.XtextResource.access$1(XtextResource.java:1)
at org.eclipse.xtext.resource.XtextResource$1.getEObject(XtextResource.java:115)
at org.eclipse.xtext.resource.DefaultFragmentProvider.getEObject(DefaultFragmentProvider.java:28)
at org.eclipse.xtext.resource.XtextResource.basicGetEObject(XtextResource.java:346)
at org.eclipse.xtext.resource.XtextResource.getEObject(XtextResource.java:332)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:235)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener.findEObjectByURI(LanguageSpecificURIEditorOpener.java:159)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener$2.process(LanguageSpecificURIEditorOpener.java:125)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener$2.process(LanguageSpecificURIEditorOpener.java:1)
at org.eclipse.xtext.util.concurrent.IUnitOfWork$Void.exec(IUnitOfWork.java:37)
at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:121)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.internalReadOnly(XtextDocument.java:520)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.readOnly(XtextDocument.java:492)
at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:133)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener.selectAndReveal(LanguageSpecificURIEditorOpener.java:121)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener$1.run(LanguageSpecificURIEditorOpener.java:88)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
My Code is very simple liking this:
acceptor.accept(issue, "Create label", "Create a new jump label", null) [ element, context |
if (element instanceof ContinueCommand) {
var lineNum = issue.lineNumber
var doc = context.xtextDocument
// If use doc.getLineOffset(lineNum). It works and inserts newline after current line.
var offset = doc.getLineOffset(lineNum-1)
var id = doc.get(issue.offset, issue.length)
var toInsert = "!" + id + " : comment\n"
doc.replace(offset, 0, toInsert)
}
]
I tried it in other quickfix methods (not for cross-references). It works good. I use xtext version 2.9.
Has anybody the same problem?