public LexerAction(
            int priority,
            LexerValueAction valueAction,
            IEnumerable<LexerModeAction> modeActions,
            LexerEmitAction emitAction,
            string code)
        {
            if(valueAction == null) throw new ArgumentNullException(nameof(valueAction));

            Priority = priority;
            ValueAction = valueAction;
            ModeActions = modeActions.ToList();
            EmitAction = emitAction;
            Code = code;
        }
        private LexerValueAction GetValueAction()
        {
            if (Commands.Contains(Command.Capture))
            {
                return(LexerValueAction.Capture);
            }

            var decode = Commands.OfType <DecodeCommand>().SingleOrDefault();

            if (decode != null)
            {
                return(LexerValueAction.Decode(decode.Base));
            }

            var text = Commands.OfType <TextCommand>().SingleOrDefault();

            if (text != null)
            {
                return(LexerValueAction.Text(text.Value));
            }

            return(LexerValueAction.Ignore);
        }