Oolite 1.91.0.7604-240417-a536cbe
Loading...
Searching...
No Matches
OOCheckJSSyntaxVerifierStage.m
Go to the documentation of this file.
1/*
2
3OOCheckJSSyntaxVerifierStage.m
4
5
6Oolite
7Copyright (C) 2004-2013 Giles C Williams and contributors
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22MA 02110-1301, USA.
23
24*/
25
27
28#if OO_OXP_VERIFIER_ENABLED
29
31#import "OOStringParsing.h"
32#import "OOScript.h"
33#import "OOJSScript.h"
35
36static NSString * const kStageName = @"Checking JS Script file syntax";
37
38
39@implementation OOCheckJSSyntaxVerifierStage
40
41- (NSString *)name
42{
43 return kStageName;
44}
45
46
47- (BOOL)shouldRun
48{
49 OOFileScannerVerifierStage *fileScanner = nil;
50
51 fileScanner = [[self verifier] fileScannerStage];
52 return ([[fileScanner filesInFolder:@"Scripts"] count] > 0);
53}
54
55
56- (void)run
57{
58 OOFileScannerVerifierStage *fileScanner = nil;
59 NSArray *scriptFiles = nil;
60 NSString *scriptFile = nil;
61 NSString *fileExt = nil;
62 NSString *filePath = nil;
63
64 fileScanner = [[self verifier] fileScannerStage];
65 scriptFiles = [fileScanner filesInFolder:@"Scripts"];
66
67 if (scriptFiles == nil) return;
68
70
71 foreach (scriptFile, scriptFiles)
72 {
73 fileExt = [[scriptFile pathExtension] lowercaseString];
74 if ([fileExt isEqualToString:@"js"] || [fileExt isEqualToString:@"es"])
75 {
76 filePath = [fileScanner pathForFile:scriptFile inFolder:@"Scripts" referencedFrom:nil checkBuiltIn:NO];
77
78 OOScript *script = [OOJSScript scriptWithPath:filePath properties:nil];
79 (void)script;
80 }
81 }
82
83
84}
85
86@end
87
88#endif
static NSString *const kStageName
static NSString *const kStageName
unsigned count
return nil
NSString * pathForFile:inFolder:referencedFrom:checkBuiltIn:(NSString *file,[inFolder] NSString *folder,[referencedFrom] NSString *context,[checkBuiltIn] BOOL checkBuiltIn)
NSArray * filesInFolder:(NSString *folder)
id scriptWithPath:properties:(NSString *path,[properties] NSDictionary *properties)
Definition OOJSScript.m:112
void setShowErrorLocations:(BOOL value)
OOJavaScriptEngine * sharedEngine()