Block comment fails to compile with long comment?


(Vince Angeloni) #1

OK, new script window and I select ‘block comment’ from the Clips menu. If I click compile with nothing there, it compiles. But when I add a rather lenghty block comment, it fails to compile with an error: "expected end of script but found ‘)’ -2,741 and highlights the ')’ line at the end of the block comment. What’s going on here? Something embedded in the text I copied from wikipedia interfering? Kind of baffled here…

—— Here is the text I am pasting in, copied from wikipedia page: ——

The UPC-A barcode is visually represented by strips of bars and spaces that encode the UPC-A 12-digit number. Each digit is represented by a unique pattern of 2 bars and 2 spaces. The bars and spaces are variable width, i.e. 1, 2, 3, or 4 modules wide. The total width for a digit is always 7 modules; consequently, UPC-A 12-digit number requires a total of 7×12 = 84 modules.

A complete UPC-A is 95 modules wide: 84 modules for the digits (L and R sections) combined with 11 modules for the S (start), M (middle), and E (end) guard patterns. The S (start) and E (end) guard patterns are 3 modules wide and use the pattern bar-space-bar, where each bar and space is one module wide. The M (middle) guard pattern is 5 modules wide and uses the pattern space-bar-space-bar-space, where each bar and space is also one module wide. In addition, a UPC-A symbol requires a quiet zone (extra space of 9 modules wide) before the S (start) and after the E (end) guard patterns

UPC-A barcodes can be printed at various densities to accommodate a variety of printing and scanning processes. The significant dimensional parameter is called x-dimension (width of single module element). The width of each bar (space) is determined by multiplying the x-dimension and the module width (1, 2, 3, or 4 units) of each bar (space). Since the guard patterns each include two bars, and each of the 12 digits of the UPC-A barcode consists of two bars and two spaces, all UPC-A barcodes consist of exactly (3 × 2) + (12 × 2) = 30 bars, of which 6 represent guard patterns and 24 represent numerical digits.

The x-dimension for the UPC-A at the nominal size is 0.33 mm (0.013"). Nominal symbol height for UPC-A is 25.9 mm (1.02"). The bars forming the S (start), M (middle), and E (end) guard patterns, are extended downwards by 5 times x-dimension, with a resulting nominal symbol height of 27.55 mm (1.08"). This also applies to the bars of the first and last numerical digit of UPC-A barcode. UPC-A can be reduced or magnified anywhere from 80% to 200%.

A quiet zone, with a width of at least 9 times the x-dimension, must be present on each side of the scannable area of the UPC-A barcode.[10][11] For a GTIN-12 number encoded in a UPC-A barcode, the first and last digits are always placed outside the symbol in order to indicate the quiet zones that are necessary for barcode scanners to work properly.


Below is description of all possible number systems with corresponding 12-digit UPC-A numbering schema LLLLLLRRRRRR, where L denotes number system digit and R check digit.

0–1, 6–9 
For most products. The LLLLL digits are the manufacturer code (assigned by local GS1 organization), and the RRRRR digits are the product code.

The UPC-A check digit may be calculated as follows:

Sum the digits at odd-numbered positions (first, third, fifth,..., eleventh).
Multiply the result by 3.
Add the digit sum at even-numbered positions (second, fourth, sixth,..., tenth) to the result.
Find the result modulo 10 (i.e. the remainder, when divided by 10) and call it M.
If M is zero, then the check digit is 0; otherwise the check digit is 10 − M.

(Vince Angeloni) #2

OK, something funny going on with the text I pasted into that post… it was all text in SD and in the post before I posted it. First line was just a copied link to the wikipedia page and in the live post, it seems to have been converted into a web preview of some sort. ? But even if you just copy the lower ‘text only’ part at the bottom, and paste into an SD block comment, the same thing happens without the wikipedia link.


(Ed Stockly) #3

This is odd indeed. It’s an appleScript compiler issue, not ScriptDebugger, as it also won’t compile in Script Editor. I narrowed it down to this, which produces the same error when trying to compile both apps.

  (*

(1.08").  

 *)
 
  

(Ed Stockly) #4

And now further narrowed it down to this:

(*
")
*)

Remove that and the whole thing compiles. Put that anywhere inside the block comment and you get a compile error.


(Phil Stokes) #5

That’s cos block comments still check for quotation balance, unlike to-end-of-line comments.

These will both compile
-- "
# "

but it’s always been the case that this won’t

(*"*)


(Mark Alldritt) #6

You also must watch for un-closed nested block comments:

(*
  (*
*)

(Shane Stanley) #7

Which it needs to do, in case quoted text contains *). So this compiles:

(*
"*)"
*)