File tree Expand file tree Collapse file tree 3 files changed +38
-7
lines changed Expand file tree Collapse file tree 3 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -264,7 +264,7 @@ class DisplayFile {
264
264
if ( value . length > 0 ) {
265
265
value += ` ` ;
266
266
267
- let inBrakcets = 0 ;
267
+ let inBrackets = 0 ;
268
268
let word = `` ;
269
269
let innerValue = `` ;
270
270
let inString = false ;
@@ -273,13 +273,13 @@ class DisplayFile {
273
273
switch ( value [ i ] ) {
274
274
case `+` :
275
275
case `-` :
276
- if ( ! inString && value [ i + 1 ] !== newLineMark ) {
276
+ if ( value [ i + 1 ] !== newLineMark ) {
277
277
innerValue += value [ i ] ;
278
278
}
279
279
break ;
280
280
281
281
case `'` :
282
- if ( inBrakcets > 0 ) {
282
+ if ( inBrackets > 0 ) {
283
283
innerValue += value [ i ] ;
284
284
} else {
285
285
if ( inString ) {
@@ -294,15 +294,23 @@ class DisplayFile {
294
294
break ;
295
295
296
296
case `(` :
297
- inBrakcets ++ ;
297
+ if ( inString ) {
298
+ innerValue += value [ i ] ;
299
+ } else {
300
+ inBrackets ++ ;
301
+ }
298
302
break ;
299
303
case `)` :
300
- inBrakcets -- ;
304
+ if ( inString ) {
305
+ innerValue += value [ i ] ;
306
+ } else {
307
+ inBrackets -- ;
308
+ }
301
309
break ;
302
310
303
311
case newLineMark :
304
312
case ` ` :
305
- if ( inBrakcets > 0 || inString ) {
313
+ if ( inBrackets > 0 || inString ) {
306
314
if ( value [ i ] !== newLineMark ) {
307
315
innerValue += value [ i ] ;
308
316
}
@@ -324,7 +332,7 @@ class DisplayFile {
324
332
if ( value [ i ] === newLineMark ) conditionalLine += 1 ;
325
333
break ;
326
334
default :
327
- if ( inBrakcets > 0 || inString )
335
+ if ( inBrackets > 0 || inString )
328
336
innerValue += value [ i ] ;
329
337
else
330
338
word += value [ i ] ;
Original file line number Diff line number Diff line change
1
+ exports . lines = [
2
+ ` A DSPSIZ(27 132 *DS4)` ,
3
+ ` A R SCRN2` ,
4
+ ` A 2 2'This text containt parentheses (Y/N)'` ,
5
+ ` A 3 2'This text containt dashes -Y/N-'` ,
6
+ ] ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const { DisplayFile } = require("../src/dspf");
4
4
const depts = require ( "./file/depts" ) ;
5
5
const replloadfm = require ( "./file/replloadfm" ) ;
6
6
const issue1149 = require ( `./file/issue1149` ) ;
7
+ const issue1382 = require ( `./file/issue1382` ) ;
7
8
8
9
exports . simple = ( ) => {
9
10
const file = new DisplayFile ( ) ;
@@ -151,4 +152,20 @@ exports.issue1149 = () => {
151
152
152
153
const windowTitle = windowFormat . keywords . find ( keyword => keyword . name === `WDWTITLE` ) ;
153
154
assert . strictEqual ( windowTitle . value , `*TEXT 'Print accounts by store number for status type - Help' *COLOR WHT` ) ;
155
+ }
156
+
157
+ exports . issue1382 = ( ) => {
158
+ const file = new DisplayFile ( ) ;
159
+ file . parse ( issue1382 . lines ) ;
160
+
161
+ const screenFormat = file . formats [ 1 ] ;
162
+ assert . strictEqual ( screenFormat . name , `SCRN2` ) ;
163
+
164
+ const textField1 = screenFormat . fields [ 0 ] ;
165
+ assert . strictEqual ( textField1 . name , `TEXT1` ) ;
166
+ assert . strictEqual ( textField1 . value , `This text containt parentheses (Y/N)` ) ;
167
+
168
+ const textField2 = screenFormat . fields [ 1 ] ;
169
+ assert . strictEqual ( textField2 . name , `TEXT2` ) ;
170
+ assert . strictEqual ( textField2 . value , `This text containt dashes -Y/N-` ) ;
154
171
}
You can’t perform that action at this time.
0 commit comments