I use react-i18next and i18next to support localization in our app, everything is going well until several days after the featue has been deployed. there are many same errors collected by sentry about the "t" function of i18next instance:
Invalid regular expression: /( |,|?|!|;/: Unterminated group
On most devices it can work perfect, but in some android pad, it raise this error, but our test devices cannot replicate it.
it seems that the last parentheses has lost, but I cannot figure out the reason about it.
Related
i am writing a compiler for a small language using byacc/j and jflex. i have no problem in finding first error in a given input file. the problem is i cant find more errors. first i used to use yacc and lex and i used special symbol 'error' token at the end of some grammar rules which was built in yacc and i could use 'yyerrok' to simply continue parsing and finding more errors but , in byacc/j i cant find something like that and yyerrok does not work and byacc/j does not recognize that. any suggestions to find more than one error in byacc/j ? or is there ' error ' and 'yyerrok' in byacc/j ?
The only thing that yyerrok does is reset the count of tokens since the last error notification. Yacc parsers suppress error messages in the first three tokens after an error recovery, to prevent cascading error messages.
Using yyerrok -- or setting yyerrflag to 0 -- indicates that error recovery was successful and that error messages should now be produced. It does not have any other effect: with or without yyerrok, parsing will continue.
yyerrok is a C macro, and Java doesn't have macros. So apparently it was dropped from the Java interface. But yyerrflag exists as a parser class member and you should be able to just set it to zero in a parser action.
No matter how I update the config file I seem to always end up with a space
System.assert(true); becomes System.assert (true);
This is only when the function is called assert
The following both format without a space before the '('
System.asser(true);
System.assertt(true);
Uncrustify config https://pastebin.com/4bnNXzhC
I believe your problem is that Java has an assert statement which Uncrustify's confusing your function call as. Although that wouldn't make much sense considering I tried to test if adding/removing spaces before control statements would change this behavior and it didn't.
I did find a workaround for you through the following configuration options parsing as Java. Since Java supports the assert statement it is a bit odd that they don't have a specific configuration option for it. It may be in your best interest to file a bug report / GH issue with the Uncrustify devs to help better resolve this problem.
# Add or remove space between the user function name and '(' on function
# calls. You need to set a keyword to be a user function in the config file,
# like:
# set func_call_user tr _ i18n
sp_func_call_user_paren = remove # ignore/add/remove/force
set func_call_user assert
Keep in mind that Apex is not an officialy supported language of Uncrustify. So if things don't work specifically for Apex then there's really not much else that can be done.
I have a similar issue as the following question: Lucene error while parsing Query: Cannot parse '': Encountered “” at line 1, column 0, and I had already tried all the escaping. What else could it be?
I'm using Kentico 12 hotfix 14, with their Lucene.NET 3.0.3 implementation. My Smart Search Index uses the Standard analyzer, see below:
I get the expected rows back when I use the following lucene syntax to pull back an en-US culture result. This syntax is automatically created by Kentico and is needed to retrieve the correct culture. This was directly copied from the property value.
"+_culture:([en-us TO en-us] [invariantifieldivaluei TO invariantifieldivaluei])"
When I add (or use alone) the following value (in many different forms - without parenthesis, etc):
"+length:(24\")"
I always get the Lexical error:
"Cannot parse '+_culture:([en-us TO en-us] [invariantifieldivaluei TO invariantifieldivaluei]) +length:(24\")': Lexical error at line 1, column 95. Encountered: <EOF> after : \"\\\")\""
As you can see, I believe that I have escaped the value for the length correctly. What am I missing here?
Other values, that don't require escaping work just fine, such as:
+material:(nitrile)
Any thoughts on what I'm doing wrong with the 24" value? Wrong analyzer? Needed Kentico hotfix? Wrong order of filters? Thanks for your time!
Seems I'm not the first to deal with this within Kentico, and found the following helper method: CMS.Search.SearchSyntaxHelper.EscapeKeyWords(string). I applied this method to my specific search filter values and it's working as expected! Lots of good methods within the parent class too, check them out.
UPDATE
It now seems that anything put in a vector breaks. I have tried char and u/int/8/16/32 and they all generate some kind of error. I'm a bit perplexed. There may be an error in my code, but I'm not sure what the YAML should look like, so I'm probably not doing a very a very good job of looking for when the data becomes incorrect.
Is YAML::Binary from Yaml-Cpp finished yet? I've tried serializing my data as int's, but Yaml-Cpp seems to be confused about ints and chars, and this generally never works. Instead, now I'm trying to use Yaml::Binary, but I get an error on the other side when I try to recover the YAML::Binary node on the other end. Specifically, this chunk fails:
3: 0\n6: WAUAAAAAAABYBQAAAAAAAP////84UBspV0FVQUFBQUFBQUJZQlFBQUFBQUFBUC8vLy84NFVCc3BWMEZWUVVGQlFVRkJRVUpaUWxGQlFVRkJRVUZCVUM4dkx5ODRORlZDYzNCV01FWldVVlZHUWxGVlJrSlJWVXBhVVd4R1FsRlZSa0pSVlVaQ1ZVTTRka3g1T0RST1JsWkRZ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IxcEdaR2xXYTFZelZteGtkMUl4YkZoVVdHaFZZbXhhVlZscldrdGpSbFp6WVVWT1dGWnNjREJhVldNMVZXc3hjbGRyYUZkTmJtaHlWMVphUzFJeA==\n7: /USER_NAMES/src/sockets/rsc/atkrscs.tar.gz\n1: 0\n4: 0\n5: 651633\n2: 0
As:
terminate called after throwing an instance of 'YAML::ParserException'
what(): yaml-cpp: error at line 7, column 7: unknown escape character:
What should I do? Is there another way to send/receive binary? Did I do something wrong?
Short: I am looking for a way to get the text of the script that was evaluated and caused a syntax error from within the context of window.onerror.
Long:
The full scenario includes a phone gap application and the PushNotifications plugins.
When a push message is sent to the device a javascript error is caught using window.onerror.
with the text "SyntaxtError: Expected token '}'"
the reported line number is 1 (is it is usually when dealing with EVALuated code.
The way the plugin executs its code is by using:
NSString * jsCallBack = [NSString stringWithFormat:#"%#(%#);", self.callback, jsonStr];
[self.webView stringByEvaluatingJavaScriptFromString:jsCallBack];
I belive but not 100% sure that this is the code PhoneGap Build are pushing
more code can be seen in here https://github.com/phonegap-build/PushPlugin/blob/master/src/ios/PushPlugin.m#L177
the self.callback is a string passed by me to the plugin and jsonStr is (supposed to be) an object describing the push message.
when I tried to pass as the parameter that ends up being self.callback the string alert('a');// then I did get the alert and no syntax error. ad now I am trying to understand what does jsonStr gets evaluated to so that maybe I can find a way around it or figure out if its my fault somehow (maybe for the content I am sending in the push notification....)
I also tried to look at the last item of the $('script') collection of the document hopeing that maybe stringByEvaluatingJavaScriptFromString generates a new script block but that does not seem to be the case.
further more in the window.onerror I also tried to get the caller
using var c=window.onerror.caller||window.onerror.arguments.caller; but this returns undefined.
As I stated before - I am looking for ideas on how to determine what exactly is causing the syntax error possibly by getting a hold of the entire block of script being evaluated when the syntax error happened.