Page 1 of 1

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

Posted: Sun Nov 25, 2012 1:39 pm
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?

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

Posted: Mon Nov 26, 2012 12:02 am
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.

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

Posted: Mon Nov 26, 2012 4:50 am
by flembobs
Ok, thanks. I will try to convert music.cfdg to version 3 syntax.

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

Posted: Tue Nov 27, 2012 12:55 am
by MtnViewJohn
I forgot to mention the syntax conversion tool.