Skip to content

Commit

Permalink
First pass at updating MA Parser to Find ObjectId for #42
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkerm committed May 29, 2016
1 parent e191da5 commit c0be416
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion SpaceBattleArena.config
Expand Up @@ -35,12 +35,29 @@ message SBAEntry with
override string ToString()
{
return Message;
}
}

int get ObjectId(this SBAEntry msg)
{
int s = msg.Message.IndexOf("#");

if (s > -1)
{
// TODO: Find end of Number
string ret = msg.Message.Segment(s+1, 3);

return (ret as int);
}

return -1;
}

//syntax FindObjectID = regex{#\d+};

syntax CustomDateTimeFormat = year:regex{\d\d\d\d} "-" month:regex{\d\d} "-" day:regex{\d\d} " " hours:regex{\d\d} ":" minutes:regex{\d\d} ":" seconds:regex{\d\d} "," milliseconds:regex{\d\d\d} => ToDateTime(year + "-" + month + "-" + day + "T" + hours + ":" + minutes + ":" + seconds + "." + milliseconds, DateTimeStyles.None);

DateTime get customDateTime(this SBAEntry msg) with EntryFieldInfo {IsTimestamp = true, IsLocalTime = true }
DateTime get customSBAPythonDateTime(this SBAEntry msg) with EntryFieldInfo {IsTimestamp = true, IsLocalTime = true }
{
optional DateTime theDateTime = CustomDateTimeFormat(msg.timestamp);

Expand Down

0 comments on commit c0be416

Please sign in to comment.