public IExpressionParser CreateParser(IUnitRegistry unitRegistry) { var tokenMatcherBuilder = new TokenMatcherBuilder(); var prefixTokenMatchers = tokenMatcherBuilder.Build(unitRegistry.GetPrefixNotations(), true); var unitTokenMatchers = tokenMatcherBuilder.Build(unitRegistry.GetUnitNotations(), false); var unitExpressionParser = new UnitExpressionParser( unitRegistry, new LexicalAnalyzer(new[] { prefixTokenMatchers, unitTokenMatchers })); return new ExpressionParser(unitExpressionParser); }
public UnitExpressionParserTests() { var unitRegistry = new UnitRegistry(); this.lexicalAnalyzer = A.Fake<ILexicalAnalyzer>(); this.testee = new UnitExpressionParser(unitRegistry, this.lexicalAnalyzer); }