Example #1
0
 MmlSourceLineSet ProcessVariableLine(MmlLine line)
 {
     if (in_comment_mode)
         return null;
     var vs = new MmlVariableSource ();
     vs.Lines.Add (line);
     result.Variables.Add (vs);
     return vs;
 }
Example #2
0
 public void SetCurrentInput(MmlLine line)
 {
     SetCurrentInput (new MmlUntypedSource (line));
 }
Example #3
0
        MmlSourceLineSet ProcessTrackLine(MmlLine line)
        {
            if (in_comment_mode)
                return null;
            result.Lexer.SetCurrentInput (line);

            string section = previous_section;
            int [] range = previous_range;
            if (result.Lexer.IsWhitespace (line.PeekChar ()))
                result.Lexer.SkipWhitespaces (true);
            else {
                if (result.Lexer.IsIdentifier (line.PeekChar (), true)) {
                    section = result.Lexer.ReadNewIdentifier ();
                    result.Lexer.SkipWhitespaces (false);
                }
                if (result.Lexer.IsNumber (line.PeekChar ())) {
                    range = result.Lexer.ReadRange ().ToArray ();
                    result.Lexer.SkipWhitespaces (true);
                }
            }
            if (range == null)
                throw new MmlException ("Current line indicates no track number, and there was no indicated tracks previously.", line.Location);

            previous_section = section;
            previous_range = range;
            result.Lexer.SkipWhitespaces (false);
            var ts = new MmlTrackSource (section, range);
            ts.Lines.Add (line);
            result.Tracks.Add (ts);
            return ts;
        }
Example #4
0
        MmlSourceLineSet ProcessPragmaLine(MmlLine line)
        {
            result.Lexer.SetCurrentInput (line);
            line.Location.LinePosition++;
            // get identifier
            var identifier = result.Lexer.ReadNewIdentifier ();
            switch (identifier) {
            case "include":
                result.Lexer.SkipWhitespaces (true);
                return ProcessIncludeLine (line);
            case "variable":
                result.Lexer.SkipWhitespaces (true);
                return ProcessVariableLine (line);
            case "macro":
                result.Lexer.SkipWhitespaces (true);
                return ProcessMacroLine (line);
            case "comment":
                in_comment_mode = true;
                return null;
            case "endcomment":
                in_comment_mode = false;
                return null;
            case "define":
            case "conditional":
            case "meta":
            case "basecount":
                break;
            default:
                throw MmlError (line.Location, String.Format ("Unexpected preprocessor directive: {0}", identifier));
            }

            result.Lexer.SkipWhitespaces (true);
            var ps = new MmlPragmaSource (identifier);
            ps.Lines.Add (line);
            result.Pragmas.Add (ps);
            return ps;
        }
Example #5
0
 MmlSourceLineSet ProcessMacroLine(MmlLine line)
 {
     if (in_comment_mode)
         return null;
     var mms = new MmlMacroSource ();
     mms.Lines.Add (line);
     result.Macros.Add (mms);
     return mms;
 }
Example #6
0
 MmlSourceLineSet ProcessIncludeLine(MmlLine line)
 {
     string file = line.Text.Substring (line.Location.LinePosition).Trim ();
     compiler.Resolver.PushInclude (file);
     this.DoProcess (new MmlInputSource [] {new MmlInputSource (file, compiler.Resolver.Resolve (file))});
     compiler.Resolver.PopInclude ();
     return new MmlUntypedSource (line);
 }
Example #7
0
 public MmlUntypedSource(MmlLine singleLine)
 {
     Lines.Add (singleLine);
 }