Newbie with Parser Error Line 1

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Newbie with Parser Error Line 1

dmend
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie with Parser Error Line 1

OpenSCAD mailing list-2

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)

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Newbie with Parser Error Line 1

MichaelAtOz
Administrator
In reply to this post by dmend

remove a_small_cube.scad, it is the file name.

 


From: Mendalski [mailto:[hidden email]]
Sent: Fri, 16 Apr 2021 08:20
To: [hidden email]
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


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
Reply | Threaded
Open this post in threaded view
|

Re: Newbie with Parser Error Line 1

mondo
In reply to this post by dmend
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,
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Newbie with Parser Error Line 1

dmend
In reply to this post by dmend
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Tutorial example style (was Re: Newbie with Parser Error Line 1)

JordanBrown
In reply to this post by dmend
[ 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?


_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

tp3
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.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

JordanBrown
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.



_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

JordanBrown
In reply to this post by tp3
Did anybody have any thought on this presentation or on the underlying document/template structure?  Is there anybody who considers themselves to be the lead editor on the tutorial?

On 4/17/2021 9:30 PM, Jordan Brown wrote:
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.




_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

JordanBrown
In reply to this post by tp3
OK, I was what the Wikipedia people call WP:BOLD, and went ahead and set up a template and changed over the first two examples at
https://en.wikibooks.org/w/index.php?title=OpenSCAD_Tutorial/Chapter_1

I didn't rig a link to github, because that's not set up.  Instead, I made the caption be a link to the WikiBooks page that holds the example.  I'm not sure on whether it really needs to be at github too, since it must be at WikiBooks.  WikiBooks has an edit history, and allows public-ish editing, so it's not clear that github adds anything.

The exact layout isn't my favorite - I'd prefer to do something more in the style that Wikipedia uses for samples - but I haven't figured out how to make that work and I didn't want to change too much about the presentation.  The magic of using a template is that if it's decided to use a different layout, you just change the template and all of the examples change.

It looks like so:

Did anybody have any thought on this presentation or on the underlying document/template structure?  Is there anybody who considers themselves to be the lead editor on the tutorial?

On 4/17/2021 9:30 PM, Jordan Brown wrote:
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.





_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

JordanBrown
On 4/21/2021 8:28 PM, Jordan Brown wrote:
I didn't rig a link to github, because that's not set up.  Instead, I made the caption be a link to the WikiBooks page that holds the example.  I'm not sure on whether it really needs to be at github too, since it must be at WikiBooks.  WikiBooks has an edit history, and allows public-ish editing, so it's not clear that github adds anything.


A problem with that theory is that when the page that contains the example is viewed, e.g. at
https://en.wikibooks.org/wiki/OpenSCAD_Tutorial/examples/a_small_cube
it is processed as wikitext.  Being processed as wikitext is not healthy for OpenSCAD programs and other living things.

You can see it "correctly" by editing the source, but encouraging people to edit the page source doesn't seem good.


_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

MichaelAtOz
Administrator

I'm not sure moving the example code out of the page (ie the chapter/section) is a good idea.

It complicates editing, if you are just taking about the tutorial, maybe as it is rather static.

 

Also won't it be a PITA creating all those pages?

 


From: Jordan Brown [mailto:[hidden email]]
Sent: Thu, 22 Apr 2021 13:41
To: OpenSCAD
Subject: [OpenSCAD] Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

 

On 4/21/2021 8:28 PM, Jordan Brown wrote:

I didn't rig a link to github, because that's not set up.  Instead, I made the caption be a link to the WikiBooks page that holds the example.  I'm not sure on whether it really needs to be at github too, since it must be at WikiBooks.  WikiBooks has an edit history, and allows public-ish editing, so it's not clear that github adds anything.



A problem with that theory is that when the page that contains the example is viewed, e.g. at
https://en.wikibooks.org/wiki/OpenSCAD_Tutorial/examples/a_small_cube
it is processed as wikitext.  Being processed as wikitext is not healthy for OpenSCAD programs and other living things.

You can see it "correctly" by editing the source, but encouraging people to edit the page source doesn't seem good.


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain;
to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

tp3
On 22.04.21 07:29, MichaelAtOz wrote:
> I'm not sure moving the example code out of the page (ie the
> chapter/section) is a good idea.

Yes, I agree. Looking more at templates to get a consistent
formatting is great, and may even help efforts to ship the
documentation for offline use at some point.

But I think the content, including the example source code
should be fully included in normal pages. The github repo I
mentioned was more meant as additional resource for easier
bulk downloading of all examples and being able to load the
files instead of typing / copy&paste.

ciao,
  Torsten.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Tutorial example style (was Re: Newbie with Parser Error Line 1)

JordanBrown
I'm not wedded to the idea of putting the source in a separate page.

I kind of liked that idea because it appeared to (maybe) allow putting the example in verbatim, and have the invocation have minimal boilerplate.  Perhaps then the text could be mirrored from github, and the images automatically created.

I'll look into other techniques.  I'm struggling a bit with how to wrap a template invocation around verbatim text, and then how to feed that verbatim text into processing in the template, while keeping the boilerplate to a minimum and keeping all of the style control in the template.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]