discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Newbie with Parser Error Line 1

M
Mendalski
Thu, Apr 15, 2021 10:19 PM

Hi,

My first time at your forum and also using OpenSCAD (Linux OS). I'm in
the WIKIBOOKS OpenSCAD Tutorial/Chapter 1, Creating you first object.

The code to enter is:

a_small_cube.scad

cube(size=10);

with the instructions to "hit the preview (first) icon on the action bar
below the reference axes."

Upon clicking the Preview Icon I get these error messages and the "s" in
the word cube.scad is highlighted red and the execution is aborted. I've
copied the lines and typed them in and get the same error. I've also
uninstalled and reinstalled OpenSCAD.

Loaded design '/home/david/scad/scad cube.scad'.

ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1:
syntax error

Execution aborted

Parsing design (AST generation)...

Saved backup file: /home/david/.local/share/OpenSCAD/backups/scad
cube-backup-KySmaALE.scad

ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1:
syntax error

Execution aborted

Any suggestions on how to resolve this?

Thanks,

Dmend

Hi, My first time at your forum and also using OpenSCAD (Linux OS). I'm in the WIKIBOOKS OpenSCAD Tutorial/Chapter 1, Creating you first object. The code to enter is: a_small_cube.scad cube(size=10); with the instructions to "hit the preview (first) icon on the action bar below the reference axes." Upon clicking the Preview Icon I get these error messages and the "s" in the word cube.scad is highlighted red and the execution is aborted. I've copied the lines and typed them in and get the same error. I've also uninstalled and reinstalled OpenSCAD. Loaded design '/home/david/scad/scad cube.scad'. ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: syntax error Execution aborted Parsing design (AST generation)... Saved backup file: /home/david/.local/share/OpenSCAD/backups/scad cube-backup-KySmaALE.scad ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: syntax error Execution aborted Any suggestions on how to resolve this? Thanks, Dmend
AR
Algot Runeman
Thu, Apr 15, 2021 11:00 PM

On 4/15/21 6:19 PM, Mendalski wrote:

a_small_cube.scad

cube(size=10);

You need to make the first line into a comment because it is not a
correct command on its own. The location of the highlight is not always
going to be helpful (though it will help if the command you have typed
is almost correct.

// a_small_cube.scad

cube(size=10)

On 4/15/21 6:19 PM, Mendalski wrote: > > a_small_cube.scad > > cube(size=10); > You need to make the first line into a comment because it is not a correct command on its own. The location of the highlight is not always going to be helpful (though it will help if the command you have typed is almost correct. // a_small_cube.scad cube(size=10)
M
MichaelAtOz
Thu, Apr 15, 2021 11:02 PM

remove a_small_cube.scad, it is the file name.


From: Mendalski [mailto:d58m@comcast.net]
Sent: Fri, 16 Apr 2021 08:20
To: discuss@lists.openscad.org
Subject: [OpenSCAD] Newbie with Parser Error Line 1

Hi,

My first time at your forum and also using OpenSCAD (Linux OS). I'm in the WIKIBOOKS OpenSCAD Tutorial/Chapter 1, Creating you first object.

The code to enter is:

a_small_cube.scad

cube(size=10);

with the instructions to "hit the preview (first) icon on the action bar below the reference axes."

Upon clicking the Preview Icon I get these error messages and the "s" in the word cube.scad is highlighted red and the execution is aborted. I've copied the lines and typed them in and get the same error. I've also uninstalled and reinstalled OpenSCAD.

Loaded design '/home/david/scad/scad cube.scad'.

ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: syntax error

Execution aborted

Parsing design (AST generation)...

Saved backup file: /home/david/.local/share/OpenSCAD/backups/scad cube-backup-KySmaALE.scad

ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: syntax error

Execution aborted

Any suggestions on how to resolve this?

Thanks,

Dmend

--
This email has been checked for viruses by AVG.
https://www.avg.com

remove a_small_cube.scad, it is the file name. _____ From: Mendalski [mailto:d58m@comcast.net] Sent: Fri, 16 Apr 2021 08:20 To: discuss@lists.openscad.org Subject: [OpenSCAD] Newbie with Parser Error Line 1 Hi, My first time at your forum and also using OpenSCAD (Linux OS). I'm in the WIKIBOOKS OpenSCAD Tutorial/Chapter 1, Creating you first object. The code to enter is: a_small_cube.scad cube(size=10); with the instructions to "hit the preview (first) icon on the action bar below the reference axes." Upon clicking the Preview Icon I get these error messages and the "s" in the word cube.scad is highlighted red and the execution is aborted. I've copied the lines and typed them in and get the same error. I've also uninstalled and reinstalled OpenSCAD. Loaded design '/home/david/scad/scad cube.scad'. ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: syntax error Execution aborted Parsing design (AST generation)... Saved backup file: /home/david/.local/share/OpenSCAD/backups/scad cube-backup-KySmaALE.scad ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: syntax error Execution aborted Any suggestions on how to resolve this? Thanks, Dmend -- This email has been checked for viruses by AVG. https://www.avg.com
RW
Ray West
Thu, Apr 15, 2021 11:04 PM

That is wrong. It seems they have put in the file name, for some obscure
reason. Leave out the first line.

On 15/04/2021 23:19, Mendalski wrote:

WIKIBOOKS OpenSCAD Tutorial/Chapter 1,

That is wrong. It seems they have put in the file name, for some obscure reason. Leave out the first line. On 15/04/2021 23:19, Mendalski wrote: > WIKIBOOKS OpenSCAD Tutorial/Chapter 1,
M
Mendalski
Fri, Apr 16, 2021 12:14 AM

Than you Ray, Michael, and Algot for your help. I will stick with the
PDF instructions you sent.

Dmend

On 4/15/21 5:19 PM, Mendalski wrote:

Hi,

My first time at your forum and also using OpenSCAD (Linux OS). I'm in
the WIKIBOOKS OpenSCAD Tutorial/Chapter 1, Creating you first object.

The code to enter is:

a_small_cube.scad

cube(size=10);

with the instructions to "hit the preview (first) icon on the action
bar below the reference axes."

Upon clicking the Preview Icon I get these error messages and the "s"
in the word cube.scad is highlighted red and the execution is aborted.
I've copied the lines and typed them in and get the same error. I've
also uninstalled and reinstalled OpenSCAD.

Loaded design '/home/david/scad/scad cube.scad'.

ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1:
syntax error

Execution aborted

Parsing design (AST generation)...

Saved backup file: /home/david/.local/share/OpenSCAD/backups/scad
cube-backup-KySmaALE.scad

ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1:
syntax error

Execution aborted

Any suggestions on how to resolve this?

Thanks,

Dmend


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Than you Ray, Michael, and Algot for your help. I will stick with the PDF instructions you sent. Dmend On 4/15/21 5:19 PM, Mendalski wrote: > > Hi, > > My first time at your forum and also using OpenSCAD (Linux OS). I'm in > the WIKIBOOKS OpenSCAD Tutorial/Chapter 1, Creating you first object. > > The code to enter is: > > a_small_cube.scad > > cube(size=10); > > with the instructions to "hit the preview (first) icon on the action > bar below the reference axes." > > Upon clicking the Preview Icon I get these error messages and the "s" > in the word cube.scad is highlighted red and the execution is aborted. > I've copied the lines and typed them in and get the same error. I've > also uninstalled and reinstalled OpenSCAD. > > Loaded design '/home/david/scad/scad cube.scad'. > > ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: > syntax error > > Execution aborted > > Parsing design (AST generation)... > > Saved backup file: /home/david/.local/share/OpenSCAD/backups/scad > cube-backup-KySmaALE.scad > > ERROR: Parser error in file "/home/david/scad/scad cube.scad", line 1: > syntax error > > Execution aborted > > Any suggestions on how to resolve this? > > Thanks, > > Dmend > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
JB
Jordan Brown
Fri, Apr 16, 2021 12:20 AM

[ This is a discussion of how the tutorial might be improved to avoid
this confusion. ]

On 4/15/2021 3:19 PM, Mendalski wrote:

The code to enter is:

a_small_cube.scad

cube(size=10);

This is indeed confusing.  I went to go see if I could fix the tutorial,
but this pattern is used throughout so it's not a simple point fix.

Here's what it looks like:

Knowing the language and that there's an issue here, it's easy to see
that "a_small_cube.scad" is in italics, and the cube() invocation is in
a different font, in a box, but (a) files haven't been covered yet, (b)
the inner box is subtle, and (c) it's easy to miss the font change.

So what should it look like?

Maybe make the file name be more distinct?

Maybe move it into the title?

(But note the double box, which is kind of strange.  The inner box is
how Wikibooks is styling <pre>.)

Wikipedia programming language samples look like

or

but do not have a title ("Code") or file name ("a_small_cube.scad").

Or something else?

My suggestion:

  • Do not include the file name in the example.  (If there's an example
    where the file name is important, as for example a discussion of
    "use <name.scad>", include it in a comment.)
  • Include the file name in a Wikibooks comment (invisible to the
    reader); it looks like there's an intent to match up file names to
    the resulting images.
  • Use the Wikipedia numbered style.
  • Use lang="text".  Although others, like lang="C", will produce some
    syntax highlighting, I doubt any of them are exactly right for
    OpenSCAD.  Or maybe lang="C" until we find a case where it doesn't
    look good.

Any thoughts?

[ This is a discussion of how the tutorial might be improved to avoid this confusion. ] On 4/15/2021 3:19 PM, Mendalski wrote: > The code to enter is: > > a_small_cube.scad > > cube(size=10); > This is indeed confusing.  I went to go see if I could fix the tutorial, but this pattern is used throughout so it's not a simple point fix. Here's what it looks like: Knowing the language and that there's an issue here, it's easy to see that "a_small_cube.scad" is in italics, and the cube() invocation is in a different font, in a box, but (a) files haven't been covered yet, (b) the inner box is subtle, and (c) it's easy to miss the font change. So what *should* it look like? Maybe make the file name be more distinct? Maybe move it into the title? (But note the double box, which is kind of strange.  The inner box is how Wikibooks is styling <pre>.) Wikipedia programming language samples look like or but do not have a title ("Code") or file name ("a_small_cube.scad"). Or something else? My suggestion: * Do not include the file name in the example.  (If there's an example where the file name is important, as for example a discussion of "use <name.scad>", include it in a comment.) * Include the file name in a Wikibooks comment (invisible to the reader); it looks like there's an intent to match up file names to the resulting images. * Use the Wikipedia numbered style. * Use lang="text".  Although others, like lang="C", will produce some syntax highlighting, I doubt any of them are exactly right for OpenSCAD.  Or maybe lang="C" until we find a case where it doesn't look good. Any thoughts?
TP
Torsten Paul
Sat, Apr 17, 2021 5:14 PM

On 16.04.21 02:20, Jordan Brown wrote:

Maybe move it into the title?

I like that option best, it might be useful to have a file
name that could be matched (or even linked?) against a github
repo with all the files.

ciao,
Torsten.

On 16.04.21 02:20, Jordan Brown wrote: > Maybe move it into the title? I like that option best, it might be useful to have a file name that could be matched (or even linked?) against a github repo with all the files. ciao, Torsten.
JB
Jordan Brown
Sun, Apr 18, 2021 4:30 AM

On 4/17/2021 10:14 AM, Torsten Paul wrote:

On 16.04.21 02:20, Jordan Brown wrote:

Maybe move it into the title?

I like that option best, it might be useful to have a file
name that could be matched (or even linked?) against a github
repo with all the files.

Here's a structure that is in some ways convenient.

I created a template {{User:Jordan Brown/sandbox/tmpl}}.  Its simplest
invocation is

{{User:Jordan Brown/sandbox/OpenSCADExample|name=a_small_cube}}

which generates:

You can see this live at
https://en.wikibooks.org/wiki/User:Jordan_Brown/sandbox/demo .

What it does, in this simple invocation, with a name FOO, is:

So the idea is that you put this simple reference into the main
document, and you create a page FOO with the OpenSCAD program, and an
image file FOO.jpg, and the template takes care of putting them together
into the preferred form.

I also put together a slightly different template OpenSCADExample2, that
produces this, which I like a little better:

... but I'm not entirely happy with the title format.

The tricky part of this is in getting it to transclude a page without
processing any wikitext on that page, so that the FOO page can contain
precisely the OpenSCAD program, without needing any protective markup. 
The mechanism that I found, the "msgnw:" modifier, seems to work but
there are hints that there may be a few kinds of wikitext that will
still be processed.

Of course, this requires that the page containing the example, the
image, and the source file on github have the same name.  That could be
viewed as a limitation, or it could be viewed as a feature encouraging
structure.  The current implementation of the template allows for
specifying the name of the image separately, as img=BAR, and allows
specifying the content directly (instead of via another page) as
content=WHATEVER.  There could be a similar override for the github
link, but isn't yet.  The image type defaults to jpg, but can be
overridden with imgtype=XXX.

All of the details are easily changed, at least until we start using it.

Of course it would get put somewhere in the main template namespace, not
in my sandbox.

The key feature is that one template then controls the format of all
examples throughout the book.

On 4/17/2021 10:14 AM, Torsten Paul wrote: > On 16.04.21 02:20, Jordan Brown wrote: >> Maybe move it into the title? > I like that option best, it might be useful to have a file > name that could be matched (or even linked?) against a github > repo with all the files. Here's a structure that is in some ways convenient. I created a template {{User:Jordan Brown/sandbox/tmpl}}.  Its simplest invocation is {{User:Jordan Brown/sandbox/OpenSCADExample|name=a_small_cube}} which generates: You can see this live at https://en.wikibooks.org/wiki/User:Jordan_Brown/sandbox/demo . What it does, in this simple invocation, with a name FOO, is: * Generates a caption with a link to https://github.com/openscad/examples/blob/master/FOO.scad * Inside a gold box, protected from wikitext processing, transcludes https://en.wikibooks.org/wiki/User:Jordan_Brown/sandbox/FOO * Brings in the image [[File:FOO.jpg]] at a size of 680px. So the idea is that you put this simple reference into the main document, and you create a page FOO with the OpenSCAD program, and an image file FOO.jpg, and the template takes care of putting them together into the preferred form. I also put together a slightly different template OpenSCADExample2, that produces this, which I like a little better: ... but I'm not entirely happy with the title format. The tricky part of this is in getting it to transclude a page *without* processing any wikitext on that page, so that the FOO page can contain precisely the OpenSCAD program, without needing any protective markup.  The mechanism that I found, the "msgnw:" modifier, seems to work but there are hints that there may be a few kinds of wikitext that will still be processed. Of course, this requires that the page containing the example, the image, and the source file on github have the same name.  That could be viewed as a limitation, or it could be viewed as a feature encouraging structure.  The current implementation of the template allows for specifying the name of the image separately, as img=BAR, and allows specifying the content directly (instead of via another page) as content=WHATEVER.  There could be a similar override for the github link, but isn't yet.  The image type defaults to jpg, but can be overridden with imgtype=XXX. All of the details are easily changed, at least until we start using it. Of course it would get put somewhere in the main template namespace, not in my sandbox. The key feature is that one template then controls the format of all examples throughout the book.