Commit b226bdda authored by Georg Vinogradov's avatar Georg Vinogradov
Browse files

Fix parsing errors

parent f2e2ec3f
Pipeline #175987 passed with stage
in 2 minutes and 52 seconds
......@@ -48,7 +48,8 @@ public class MqttConnectionSymbolCreator implements TagSymbolCreator {
* at http://www.regexplanet.com/advanced/java/index.html
*/
public static final Pattern pattern = Pattern.compile("\\s*\\{\\s*topic\\s*=\\s*\\(\\s*([a-z|A-Z|~|/][0-9|a-z|A-Z|_|/]*)\\s*,\\s*([a-z|A-Z][0-9|a-z|A-Z|_|/]*)\\s*\\)\\s*(s*,\\s*msgField\\s*=\\s*([a-z|A-Z][a-z|A-Z|1-9|_|\\.|::|\\(|\\)]*)\\s*)?\\s*\\}\\s*");
// \s*\{\s*topic\s*=\s*([a-z|A-Z|~|/][0-9|a-z|A-Z|_|/]*)\s*(s*,\s*msgField\s*=\s*([a-z|A-Z][a-z|A-Z|1-9|_|\.|::|\(|\)]*)\s*)?\s*\}\s*
public static final Pattern pattern = Pattern.compile("\\s*\\{\\s*topic\\s*=\\s*([a-z|A-Z|~|/][0-9|a-z|A-Z|_|/]*)\\s*(s*,\\s*msgField\\s*=\\s*([a-z|A-Z][a-z|A-Z|1-9|_|\\.|::|\\(|\\)]*)\\s*)?\\s*\\}\\s*");
public static Scope getGlobalScope(final Scope scope) {
Scope s = scope;
......@@ -124,7 +125,7 @@ public class MqttConnectionSymbolCreator implements TagSymbolCreator {
.forEachOrdered(m ->
taggedSymbols.stream()
.forEachOrdered(s -> {
MqttConnectionSymbol tmpSymbol = new MqttConnectionSymbol(m.group(1), m.group(4)); // topicName, msgField
MqttConnectionSymbol tmpSymbol = new MqttConnectionSymbol(m.group(1), m.group(3)); // topicName, msgField
tagging.addTag(s, tmpSymbol);
if (s.isKindOf(EMAPortSymbol.KIND)) {
EMAPortSymbol p = (EMAPortSymbol) s;
......
......@@ -76,6 +76,7 @@ public class TaggingTest extends AbstractTaggingResolverTest {
tag = (MqttConnectionSymbol) tags.iterator().next();
assertEquals(tag.getTopicName(), Optional.empty());
assertEquals(tag.getMsgField(), Optional.empty());
}
@Test
......
package middleware.mqtt;
component BasicParsing{
port in Q mqttIn;
port in Q noMqttIn;
port in Q emptyTagIn;
port out Q mqttOut;
port out Q noMqttOut;
}
\ No newline at end of file
package middleware.mqtt;
conforms to middleware.mqtt.MqttToEmamTagSchema;
tags Echo {
tag basicParsing.mqttIn with MqttConnection = {topic = /clock, msgField = clock.toSec()};
tag basicParsing.mqttOut with MqttConnection = {topic = /echo, msgField = data};
tag basicParsing.emptyTagIn with MqttConnection;
}
\ No newline at end of file
package middleware.mqtt;
component OptionalMsgField{
port in Q in1;
port out Q out1;
}
\ No newline at end of file
package middleware.mqtt;
conforms to middleware.mqtt.MqttToEmamTagSchema;
tags OptionalMsgField{
tag optionalMsgField.in1 with MqttConnection = {topic = name1};
tag optionalMsgField.out1 with MqttConnection = {topic = name1, msgField = msgField1};
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment