Importing a file syntax error "Illegal mixture of old..."

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
flembobs
Posts: 47
Joined: Tue Oct 09, 2012 3:00 pm

Importing a file syntax error "Illegal mixture of old..."

Post by flembobs »

I have two .cfdg files in the same directory.

When I try to import music.cfdg into file concert.cfdg I get the error:

Code: Select all

Restarting as a version 3 design

Reading rules file music.cfdg

Error in music.cfdg at line 3 - Illegal mixture of old and new elements

Error in music.cfdg at line 4 - syntax error
Here is the code for concert.cfdg:

Code: Select all

startshape CONCERT
import "music.cfdg"
Here is the code for music.cfdg:

Code: Select all

startshape STAVE

rule STAVE
{
	5*{y 4}LINE[]
	STAVE[r 0.75 x 1 s 0.999]
}

//lines of the stave
rule LINE
{
	SQUARE[]
}
rule LINE 0.01
{
	NOTE[]
	SQUARE[]
}

//notes and where they appear on the stave
rule NOTE 1
{
	SEMIBREVE[y -2 s 2]
}

rule NOTE 2
{
	MINIM[y - 2 s 2]
}

rule NOTE 3
{
	CROTCHET[y -2 s 2]
}

rule NOTE 4
{
	QUAVER[y -2 s 2]
}

rule NOTE 5
{
	SEMIQUAVER[y -2 s 2]
}

//different note types and how to draw them

path SEMIBREVE
{
	MOVETO{}
	ARCTO{x 1 y 1}
	ARCTO{x 0 y 2}
	ARCTO{x -1 y 1}
	ARCTO{x 0 y 0}
	CLOSEPOLY{}
	STROKE{width 0.4}
}

path MINIM
{
	MOVETO{}
	ARCTO{x 1 y 1}
	ARCTO{x 0 y 2}
	ARCTO{x -1 y 1}
	ARCTO{x 0 y 0}
	CLOSEPOLY{}
	MOVETO{x 1 y 1}
	LINEREL{y 4}
	STROKE{width 0.4}
}

path CROTCHET
{
	MOVETO{}
	ARCTO{x 1 y 1}
	ARCTO{x 0 y 2}
	ARCTO{x -1 y 1}
	ARCTO{x 0 y 0}
	CLOSEPOLY{}
	STROKE{width 0.4}
	FILL{}
	MOVETO{x 1 y 1}
	LINEREL{y 4}
	STROKE{width 0.4}
}

path QUAVER
{
	MOVETO{}
	ARCTO{x 1 y 1}
	ARCTO{x 0 y 2}
	ARCTO{x -1 y 1}
	ARCTO{x 0 y 0}
	CLOSEPOLY{}
	STROKE{width 0.4}
	FILL{}
	MOVETO{x 1 y 1}
	LINEREL{y 4}
	CURVEREL{x 1.5 y -1.5 x1 0.5 y1 -1}
	STROKE{width 0.4}
}

path SEMIQUAVER
{
	MOVETO{}
	ARCTO{x 1 y 1}
	ARCTO{x 0 y 2}
	ARCTO{x -1 y 1}
	ARCTO{x 0 y 0}
	CLOSEPOLY{}
	STROKE{width 0.4}
	FILL{}
	MOVETO{x 1 y 1}
	LINEREL{y 4}
	CURVEREL{x 1.5 y -1.5 x1 0.5 y1 -1}
	MOVETO{x 1 y 3.9}
	CURVEREL{x 1.5 y -1.5 x1 0.5 y1 -1}
	STROKE{width 0.4}
}
music.cfdg compiles fine by itself. What could be causing this?

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Importing a file syntax error "Illegal mixture of old...

Post by MtnViewJohn »

You cannot mix version 2 syntax and version 3 syntax in the same design. If concert.cfdg uses v3 syntax then you must convert music.cfdg to v3 as well. If concert.cfdg is v2 syntax then use

Code: Select all

include music.cfdg

to include it.

The reason that v2 uses include while v3 uses import is because Context Free does not initially know whether a file is v2 syntax or v3 syntax. Including a file before the syntax version is resolved leads to problems. So we use different keywords for file inclusion for the two syntax versions.

flembobs
Posts: 47
Joined: Tue Oct 09, 2012 3:00 pm

Re: Importing a file syntax error "Illegal mixture of old...

Post by flembobs »

Ok, thanks. I will try to convert music.cfdg to version 3 syntax.

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Importing a file syntax error "Illegal mixture of old...

Post by MtnViewJohn »

I forgot to mention the syntax conversion tool.

Post Reply