private IRule GetRegisterMap(IFluentParserConfigurator config) { var register = config.Rule(); register.IsMadeUp.By(constants).As("Name").WhenFound(f => this.valueMap[f.Name]).Or. By(registers).As("Name").WhenFound(f => this.valueMap[f.Name]).Or. By("[").Followed.By(registers).As("Name").Followed.By("]").WhenFound(f => (ushort) (this.valueMap[f.Name] + 0x8)).Or. By("[").Followed.By(hex).As("Hex").Followed.By("+").Followed.By(register).As("Reg").Followed.By("]").WhenFound(f => this.instructionResolver.ResolveRegisterPointer(f.Hex, f.Reg)).Or. By("[").Followed.By(hex).As("Hex").Followed.By("]").WhenFound(f => this.instructionResolver.ResolveNextWord(f.Hex)).Or. By(hex).As("Hex").WhenFound(f => this.instructionResolver.ResolveHex(f.Hex)).Or. By(digit).As("Digit").WhenFound(f => this.instructionResolver.ResolveLiteralValue(f.Digit)).Or. By("[").Followed.By(label).As("Label").Followed.By("+").Followed.By(registers).As("Reg").Followed.By("]").WhenFound(f => this.instructionResolver.ResolveLabelAndRegister(f.Label, f.Reg)).Or. By(label); return register; }
private IRule DataParts(IFluentParserConfigurator config) { var datarules = config.Rule(); datarules.IsMadeUp.By(config.QuotedString).As("String").WhenFound(f => f).Or .By(hex).As("Binary").WhenFound(f => f).Or .By(digit).As("Digit").WhenFound(f => f); return datarules; }