├── .gitattributes ├── Aphid ├── Aphid.csproj ├── Aphid.csproj.vspscc ├── App.config ├── HelloWorld.alx ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── AphidCodeGenerator ├── Aphid.Code.alx ├── Aphid.Tmpl.alx ├── Aphid.alx ├── Aphid.ll ├── AphidBinaryOperatorExpressionRule.cs ├── AphidCodeGenerator.csproj ├── AphidCodeGenerator.csproj.vspscc ├── AphidLexerGenerator.cs ├── AphidObjectGenerator.cs ├── AphidParserGenerator.cs ├── AphidParserRules.cs ├── App.config ├── IAphidCodeObject.cs ├── ParserRules.alx ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── AphidVSShell ├── AphidVSShell.AboutBoxPackage │ ├── AboutBox.xaml │ ├── AboutBox.xaml.cs │ ├── AphidVSShell.AboutBoxPackage.cs │ ├── AphidVSShell.AboutBoxPackage.csproj │ ├── AphidVSShell.AboutBoxPackage.csproj.vspscc │ ├── AphidVSShell.AboutBoxPackage.vsct │ ├── Guids.cs │ ├── Key.snk │ ├── PkgCmdID.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── VSPackage.resx │ └── source.extension.vsixmanifest ├── AphidVSShell │ ├── AphidVSShell.Application.pkgdef │ ├── AphidVSShell.cpp │ ├── AphidVSShell.exe.config │ ├── AphidVSShell.exe.manifest │ ├── AphidVSShell.h │ ├── AphidVSShell.pkgdef │ ├── AphidVSShell.pkgundef │ ├── AphidVSShell.rc │ ├── AphidVSShell.reg │ ├── AphidVSShell.vcxproj │ ├── AphidVSShell.vcxproj.filters │ ├── AphidVSShell.vcxproj.vspscc │ ├── AphidVSShell.winprf │ ├── ApplicationIcon.ico │ ├── DebuggerProxy.dll │ ├── DebuggerProxy.dll.manifest │ ├── Documentation │ │ ├── Images │ │ │ └── AppEnv.jpg │ │ └── ReadMe.htm │ ├── General.vssettings │ ├── Resource.h │ ├── ShellSection.cpp │ ├── ShellSection.h │ ├── Splash.bmp │ ├── VsSDK.props │ ├── small.ico │ ├── stdafx.cpp │ └── stdafx.h ├── AphidVSShellUI │ ├── AphidVSShellUI.cpp │ ├── AphidVSShellUI.rc │ ├── AphidVSShellUI.vcxproj │ ├── AphidVSShellUI.vcxproj.filters │ ├── AphidVSShellUI.vcxproj.vspscc │ ├── ApplicationCommands.vsct │ └── resource.h └── ShellExtensionsVSIX │ ├── Properties │ └── AssemblyInfo.cs │ ├── ShellExtensionsVSIX.csproj │ ├── ShellExtensionsVSIX.csproj.vspscc │ └── source.extension.vsixmanifest ├── Components.Aphid.Net ├── AphidRequest.cs ├── Components.Aphid.Net.csproj ├── Components.Aphid.Net.csproj.vspscc ├── HttpLibrary.cs └── Properties │ └── AssemblyInfo.cs ├── Components.Aphid.Tests.Integration ├── AphidObjectTests.cs ├── AphidTests.cs ├── AssignmentTests.cs ├── Components.Aphid.Tests.Integration.csproj ├── Components.Aphid.Tests.Integration.csproj.vspscc ├── ConditionalTests.cs ├── FunctionTests.cs ├── InitTests.cs ├── ListTests.cs ├── LiteralTests.cs ├── LoopTests.cs ├── NullTests.cs ├── OperatorTests.cs ├── OrderOfOperationsTests.cs ├── Properties │ └── AssemblyInfo.cs ├── PropertyTests.cs ├── QueryTests.cs ├── ScopeTests.cs ├── StringTests.cs ├── ThisTests.cs └── packages.config ├── Components.Aphid.VSPackage ├── AphidAuthoringScope.cs ├── AphidLanguageService.cs ├── AphidPackage.cs ├── AphidScanner.cs ├── Components.Aphid.VSPackage.csproj ├── Components.Aphid.VSPackage.csproj.user ├── GlobalSuppressions.cs ├── Guids.cs ├── Key.snk ├── Properties │ └── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Resources │ └── Package.ico ├── TokenHelper.cs ├── VSPackage.resx ├── source.extension.vsixmanifest └── todo.txt ├── Components.Aphid ├── App.config ├── Components.Aphid.csproj ├── Components.Aphid.csproj.vspscc ├── Interpreter │ ├── AphidFunction.cs │ ├── AphidInteropFunction.cs │ ├── AphidInteropFunctionAttribute.cs │ ├── AphidInterpreter.cs │ ├── AphidLibraryAttribute.cs │ ├── AphidLoader.cs │ ├── AphidObject.cs │ ├── AphidObject.g.cs │ ├── AphidObjectConverter.cs │ ├── AphidPropertyAttribute.cs │ ├── AphidRef.cs │ ├── AphidScope.cs │ ├── IAphidBindable.cs │ ├── InterpreterException.cs │ ├── OperatorHelper.cs │ └── ValueHelper.cs ├── Lexer │ └── AphidLexer.cs ├── Library │ ├── Conversion.alx │ ├── Dbg.alx │ ├── DebugLibrary.cs │ ├── Env.alx │ ├── EnvironmentLibrary.cs │ ├── IO.alx │ ├── IOLibrary.cs │ ├── List.alx │ ├── Query.alx │ ├── Reflection.alx │ ├── ReflectionLibrary.cs │ ├── StandardLibrary.cs │ ├── Std.alx │ ├── String.alx │ ├── Threading.alx │ └── ThreadingLibrary.cs ├── Parser │ ├── AphidNode.cs │ ├── AphidNodeCollection.cs │ ├── AphidParser.cs │ ├── AphidParser.g.cs │ ├── AphidParserException.cs │ ├── AphidRuntimeException.cs │ ├── ArrayAccessExpression.cs │ ├── ArrayExpression.cs │ ├── BinaryOperatorExpression.cs │ ├── BooleanExpression.cs │ ├── BreakExpression.cs │ ├── CallExpression.cs │ ├── ControlFlowStatement.cs │ ├── DynamicMemberExpression.cs │ ├── ElseExpression.cs │ ├── Expression.cs │ ├── ForEachExpression.cs │ ├── ForExpression.cs │ ├── FunctionExpression.cs │ ├── IdentifierExpression.cs │ ├── IfExpression.cs │ ├── LoadLibraryExpression.cs │ ├── LoadScriptExpression.cs │ ├── MemberExpression.cs │ ├── NullExpression.cs │ ├── NumberExpression.cs │ ├── ObjectExpression.cs │ ├── PartialFunctionExpression.cs │ ├── PatternMatchingExpression.cs │ ├── Statement.cs │ ├── StringExpression.cs │ ├── StringParser.cs │ ├── ThisExpression.cs │ ├── UnaryOperatorExpression.cs │ └── ValueExpression.cs ├── Properties │ └── AssemblyInfo.cs └── Todo.txt ├── Components.ConsolePlus ├── Cli.cs ├── CliLexerState.cs ├── CliProgressBar.cs ├── Components.ConsolePlus.csproj ├── Components.ConsolePlus.csproj.vspscc ├── DumpMode.cs └── Properties │ └── AssemblyInfo.cs ├── Components.Net ├── Components.Net.csproj ├── Components.Net.csproj.vspscc ├── Http │ ├── ChunkedTransferEncoding.cs │ ├── ContentDisposition.cs │ ├── FieldValuePair.cs │ ├── FormData.cs │ ├── FormUrlEncoder.cs │ ├── HttpClient.cs │ ├── HttpConnection.cs │ ├── HttpField.cs │ ├── HttpMessagePart.cs │ ├── HttpMethod.cs │ ├── HttpRequest.cs │ ├── HttpResponse.cs │ ├── HttpUpload.cs │ ├── HttpVersion.cs │ └── MimeType.cs └── Properties │ └── AssemblyInfo.cs ├── Components ├── ByteArrayExtension.cs ├── CSharpHelper.cs ├── CodeExpressionExtension.cs ├── CodeHelper.cs ├── CodeMemberMethodExtension.cs ├── CodeMethodReferenceExpressionExtension.cs ├── Components.csproj ├── Components.csproj.vspscc ├── DictionaryExtension.cs ├── DirectoryInfoExtension.cs ├── HashAlgorithmExtension.cs ├── IEnumerableExtension.cs ├── IOHelper.cs ├── IServiceLocator.cs ├── ItemEventArgs.cs ├── PathHelper.cs ├── PluginLoader.cs ├── Properties │ └── AssemblyInfo.cs ├── ServiceLocator.cs ├── StreamExtension.cs ├── StringEnumerableExtension.cs ├── StringExtension.cs ├── TableBase.cs ├── TypeExtension.cs ├── WebClientHelper.cs ├── WebClientHelperResponse.cs └── XmlSerializerExtension.cs ├── ComponentsUnitTests ├── ComponentsUnitTests.csproj ├── ComponentsUnitTests.csproj.vspscc ├── Properties │ └── AssemblyInfo.cs └── UnitTest1.cs ├── LLex ├── AlxFile.cs ├── BinaryExpression.cs ├── CharExpression.cs ├── GroupExpression.cs ├── LLex.csproj ├── LLex.csproj.vspscc ├── LLexFile.cs ├── LLexNameInfo.cs ├── LexFileMode.cs ├── LexerGenerator.cs ├── LexerState.cs ├── OperatorExpression.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── RegexCompiler.cs ├── RegexExpression.cs ├── RegexLexer.cs ├── RegexNode.cs ├── RegexParser.cs ├── Resources │ ├── AddTokenTemplate.cs │ ├── CaseTemplate.cs │ ├── LexicalAnalyzerTemplate.cs │ ├── RootStateTemplate.cs │ └── StateTemplate.cs ├── TokenEntry.cs ├── TokenTable.cs ├── app.config ├── php.ll └── regex.ll ├── LexerTestGenerator ├── App.config ├── LexerTestGenerator.csproj ├── LexerTestGenerator.csproj.vspscc ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── Tokens.cs └── packages.config ├── MonoBuildScriptGenerator ├── App.config ├── BuildScriptGenerator.cs ├── MonoBuildScriptGenerator.csproj ├── MonoBuildScriptGenerator.csproj.vspscc ├── Program.cs ├── Project.cs ├── Properties │ └── AssemblyInfo.cs ├── WindowsBuildScriptGenerator.cs └── phpvh.cmd ├── PhpVH.SelfTest ├── App.config ├── NUnitResults.cs ├── PhpVH.SelfTest.csproj ├── PhpVH.SelfTest.csproj.vspscc ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SelfTest.cs ├── SelfTestAssembly.cs ├── TestResult.cs └── Tests.alx ├── PhpVH.Tests.Integration ├── ApiOverrideTester.cs ├── App.config ├── ArrayFunctionTests.cs ├── BasicTests.cs ├── CodeCoverageTests.cs ├── Php │ ├── ArbitraryRead │ │ └── ArbitraryRead.php │ ├── ArbitraryUpload │ │ └── ArbitraryUpload.php │ ├── CodeCoverage │ │ ├── CodeCoverage.php │ │ ├── CodeCoverage2.php │ │ ├── CodeCoverage3.php │ │ └── CodeCoverage4.php │ ├── CommandInjection │ │ ├── ArbitraryCommandCookie.php │ │ ├── ArbitraryCommandGet.php │ │ ├── ArbitraryCommandGet2.php │ │ ├── ArbitraryCommandPost.php │ │ └── ArbitraryCommandPost2.php │ ├── DynamicInvocation │ │ ├── DynamicClass.php │ │ ├── DynamicClass2.php │ │ ├── DynamicFunction.php │ │ └── DynamicFunction2.php │ ├── FalsePositiveCheck.php │ ├── LocalFileInclusion │ │ ├── LfiCookie.php │ │ ├── LfiGet.php │ │ └── LfiPost.php │ ├── OpenRedirect │ │ ├── OpenRedirect.php │ │ └── OpenRedirect2.php │ ├── PhpInjection │ │ ├── ArbitraryPhpCookie.php │ │ ├── ArbitraryPhpGet.php │ │ └── ArbitraryPhpPost.php │ ├── SqlInjection │ │ ├── SqlInjectionCookie.php │ │ ├── SqlInjectionGet.php │ │ ├── SqlInjectionGet2.php │ │ ├── SqlInjectionGet3.php │ │ ├── SqlInjectionGet4.php │ │ ├── SqlInjectionGet5.php │ │ ├── SqlInjectionPost.php │ │ ├── SqliteInjectionGet.php │ │ ├── SqliteInjectionGet2.php │ │ ├── SqliteInjectionGet3.php │ │ └── SqliteInjectionGet4.php │ └── Xss │ │ ├── XssAttribute.php │ │ ├── XssBadFilter.php │ │ ├── XssGet.php │ │ ├── XssGet2.php │ │ └── XssPost.php ├── PhpTester.cs ├── PhpVH.Tests.Integration.csproj ├── PhpVH.Tests.Integration.csproj.vspscc ├── PhpVHTester.cs ├── Properties │ └── AssemblyInfo.cs ├── TestSettings.cs ├── VulnerabilityScannerTests.cs └── packages.config ├── PhpVH.Tests.Unit ├── CodeCoverage │ ├── AnnotatorTests.cs │ └── CodeCoverageCalculatorTests.cs ├── FormScraperTest.cs ├── Html │ ├── AbsoluteUri.html │ ├── AbsoluteUri2.html │ ├── AbsoluteUri3.html │ ├── Form1.html │ ├── JavaScriptUri.html │ ├── MailTo.html │ ├── RelativeUri.html │ ├── RelativeUri2.html │ ├── RelativeUri3.html │ └── UriLike.html ├── LexicalAnalysis │ ├── LexerAssert.cs │ ├── LexerCommentTest.cs │ ├── LexerHereDocTest.cs │ ├── LexerTest.Generated.cs │ ├── LexerTest.cs │ ├── Pairs.cs │ ├── TokenAssert.cs │ ├── TokenPairs.cs │ └── TokenTest.cs ├── Php │ └── StaticAnalyzerSuperglobalFields.php ├── PhpVH.Tests.Unit.csproj ├── PhpVH.Tests.Unit.csproj.vspscc ├── Properties │ └── AssemblyInfo.cs ├── StaticAnalyzerTests.cs ├── UriScraperTest.cs └── packages.config ├── PhpVH.Tests ├── ExternalResourceTest.cs ├── HtmlTest.cs ├── PhpTest.cs ├── PhpVH.Tests.csproj ├── PhpVH.Tests.csproj.vspscc └── Properties │ └── AssemblyInfo.cs ├── PhpVH.sln ├── PhpVH.vssscc ├── PhpVH ├── ApplicationMap.cs ├── ApplicationMapPage.cs ├── BodyChunk.cs ├── CodeAnalysis │ ├── BooleanExpressionAnalyzer.cs │ ├── Expression.cs │ ├── ExpressionAnalyzer.cs │ ├── ExpressionWalker.cs │ ├── PageSuperGlobalValueTable.cs │ ├── SuperGlobalNameValuePair.cs │ ├── SuperGlobalValueCollector.cs │ ├── SuperGlobalValueList.cs │ ├── SuperGlobalValueTable.cs │ └── SwitchStatementAnalyzer.cs ├── CodeCoverage │ ├── Annotation.cs │ ├── AnnotationFileReader.cs │ ├── AnnotationList.cs │ ├── AnnotationTable.cs │ ├── Annotator.cs │ ├── CodeCoverageCalculator.cs │ ├── CodeCoverageTable.cs │ ├── CodePage.cs │ ├── CodePageTable.cs │ ├── CoverageCommenter.cs │ ├── CoveragePageTemplate.html │ ├── IFileReader.cs │ ├── IndexTemplate.html │ └── PluginAnnotationTable.cs ├── DelimiterOptions.cs ├── Delimiters.cs ├── DiscoveryReport.cs ├── Doc │ └── Readme.txt ├── ExeProbe.cs ├── FileIncludeTable.cs ├── FileTrace.cs ├── FormScraper.cs ├── FormTag.cs ├── FunctionCall.cs ├── Hook.cs ├── HookCollection.cs ├── HtmlTag.cs ├── HttpResponse.cs ├── HttpResponseReader.cs ├── InputTag.cs ├── Jpeg.cs ├── LexicalAnalysis │ └── Lexer.cs ├── MessageDumper.cs ├── MessageType.cs ├── MimeTypes.cs ├── PageFieldTable.cs ├── PatchHelper.cs ├── Php.cs ├── PhpName.cs ├── PhpParser.cs ├── PhpResource.cs ├── PhpResources │ ├── Annotation.php │ ├── DynamicProbes.php │ ├── PhpApiOverrides.php │ ├── SuperGlobalOverride.php │ └── VersionProbe.php ├── PhpVH.csproj ├── PhpVH.csproj.vspscc ├── PhpVersionTester.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── ReportFile.cs ├── ReportWriter.cs ├── RequestBuilder.cs ├── ScanAlert.cs ├── ScanAlertCollection.cs ├── ScanAlertOptions.cs ├── ScanConfig.cs ├── ScanMetrics.cs ├── ScanPlugins │ ├── ArbitraryPhpScanConfig.cs │ ├── ArbitraryPhpScanPlugin.cs │ ├── ArbitraryPhpScanPlugin.xml │ ├── Command.alx │ ├── CommandScanConfig.cs │ ├── CommandScanPlugin.cs │ ├── ConfigurableScanPluginBase.cs │ ├── DynamicScanPlugin.cs │ ├── FileScanMode.cs │ ├── FileScanPlugin.cs │ ├── FullPathDisclosureScanPlugin.cs │ ├── IEnumerableSqlFunctionExtension.cs │ ├── LocalFileInclusion.alx │ ├── LocalFileInclusionScanPlugin.cs │ ├── OpenRedirectScanPlugin.cs │ ├── PluginConfig.cs │ ├── ResponseSplittingPlugin.cs │ ├── ScanPluginBase.cs │ ├── ScriptableScanPluginBase.cs │ ├── SqlFunction.cs │ ├── SqlScanConfig.cs │ ├── SqlScanPlugin.cs │ ├── SqlScanPlugin.xml │ ├── Xss.alx │ ├── XssScanConfig.cs │ └── XssScanPlugin.cs ├── ScannerCli.cs ├── ScriptLauncher.cs ├── StaticAnalysis │ ├── ArbitraryUploadPlugin.cs │ ├── CommandInjectionPlugin.cs │ ├── CommandInjectionPlugin2.cs │ ├── ExtractPlugin.cs │ ├── InsecureCallPlugin.cs │ ├── LfiPlugin.cs │ ├── OpenRedirectPlugin.cs │ ├── PhpInjectionPlugin.cs │ ├── SqlInjectionPlugin.cs │ ├── StaticAnalysisAlert.cs │ ├── StaticAnalysisEngine.cs │ ├── StaticAnalysisFileAlertCollection.cs │ ├── StaticAnalysisFileAlerts.cs │ ├── StaticAnalysisPlugin.cs │ └── XssScanPlugin.cs ├── StaticAnalyzer.cs ├── StringParser.cs ├── StringSanitizer.cs ├── SyntaxHighlighter │ ├── MIT-LICENSE │ ├── compass │ │ ├── _theme_template.scss │ │ ├── config.rb │ │ ├── shCore.scss │ │ ├── shCoreDefault.scss │ │ ├── shCoreDjango.scss │ │ ├── shCoreEclipse.scss │ │ ├── shCoreEmacs.scss │ │ ├── shCoreFadeToGrey.scss │ │ ├── shCoreMDUltra.scss │ │ ├── shCoreMidnight.scss │ │ ├── shCoreRDark.scss │ │ ├── shThemeDefault.scss │ │ ├── shThemeDjango.scss │ │ ├── shThemeEclipse.scss │ │ ├── shThemeEmacs.scss │ │ ├── shThemeFadeToGrey.scss │ │ ├── shThemeMDUltra.scss │ │ ├── shThemeMidnight.scss │ │ └── shThemeRDark.scss │ ├── scripts │ │ ├── shAutoloader.js │ │ ├── shBrushAS3.js │ │ ├── shBrushAppleScript.js │ │ ├── shBrushBash.js │ │ ├── shBrushCSharp.js │ │ ├── shBrushColdFusion.js │ │ ├── shBrushCpp.js │ │ ├── shBrushCss.js │ │ ├── shBrushDelphi.js │ │ ├── shBrushDiff.js │ │ ├── shBrushErlang.js │ │ ├── shBrushGroovy.js │ │ ├── shBrushJScript.js │ │ ├── shBrushJava.js │ │ ├── shBrushJavaFX.js │ │ ├── shBrushPerl.js │ │ ├── shBrushPhp.js │ │ ├── shBrushPlain.js │ │ ├── shBrushPowerShell.js │ │ ├── shBrushPython.js │ │ ├── shBrushRuby.js │ │ ├── shBrushSass.js │ │ ├── shBrushScala.js │ │ ├── shBrushSql.js │ │ ├── shBrushVb.js │ │ ├── shBrushXml.js │ │ ├── shCore.js │ │ └── shLegacy.js │ ├── src │ │ ├── shAutoloader.js │ │ ├── shCore.js │ │ └── shLegacy.js │ └── styles │ │ ├── shCore.css │ │ ├── shCoreDefault.css │ │ ├── shCoreDjango.css │ │ ├── shCoreEclipse.css │ │ ├── shCoreEmacs.css │ │ ├── shCoreFadeToGrey.css │ │ ├── shCoreMDUltra.css │ │ ├── shCoreMidnight.css │ │ ├── shCoreRDark.css │ │ ├── shThemeDefault.css │ │ ├── shThemeDjango.css │ │ ├── shThemeEclipse.css │ │ ├── shThemeEmacs.css │ │ ├── shThemeFadeToGrey.css │ │ ├── shThemeMDUltra.css │ │ ├── shThemeMidnight.css │ │ └── shThemeRDark.css ├── Todo.txt ├── TraceTable.cs ├── TracedFunctionCall.cs ├── UriScraper.cs ├── UriScraperModule.cs └── app.config ├── PhpVHGui ├── App.config ├── App.xaml ├── App.xaml.cs ├── Content │ └── Images │ │ └── PHPVHGuide-1.png ├── DialogWindow.xaml ├── DialogWindow.xaml.cs ├── Guide.xaml ├── Guide.xaml.cs ├── PHP Vulnerability Hunter Guide.htm ├── PhpVHGui.csproj ├── PhpVHGui.csproj.vspscc ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Window1.xaml └── Window1.xaml.cs ├── PhpVHProbe ├── PhpVHProbe.csproj ├── PhpVHProbe.csproj.vspscc ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── app.config ├── PhpVHReportViewer ├── App.xaml ├── App.xaml.cs ├── Models │ ├── CommandWireup.cs │ └── DependencyObjectExtension.cs ├── PhpVHReportViewer.csproj ├── PhpVHReportViewer.csproj.vspscc ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── ViewModels │ ├── AlertViewModel.cs │ ├── BaseViewModel.cs │ ├── ItemViewModel.cs │ └── ScanViewModel.cs ├── Views │ ├── DynamicAnalysisDetailsControl.xaml │ ├── DynamicAnalysisDetailsControl.xaml.cs │ ├── DynamicAnalysisVulnerabilityControl.xaml │ ├── DynamicAnalysisVulnerabilityControl.xaml.cs │ ├── DynamicAnalysisVulnerabilityViewerControl.xaml │ ├── DynamicAnalysisVulnerabilityViewerControl.xaml.cs │ ├── StaticAnalysisResultsControl.xaml │ └── StaticAnalysisResultsControl.xaml.cs ├── Window1.xaml ├── Window1.xaml.cs └── app.config ├── ReleasePackager ├── App.config ├── Cleanup.cs ├── FileSystemInfoHelper.cs ├── MSBuild.cs ├── PhpVH.alx ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── Release.cs ├── ReleasePackager.csproj ├── ReleasePackager.csproj.vspscc └── ReleaseProject.cs └── build.cmd /Aphid/Aphid.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /Aphid/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Aphid/HelloWorld.alx: -------------------------------------------------------------------------------- 1 | #'Std'; 2 | print('hello world'); -------------------------------------------------------------------------------- /AphidCodeGenerator/AphidBinaryOperatorExpressionRule.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Interpreter; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AphidCodeGenerator 9 | { 10 | public class AphidBinaryOperatorExpressionRule 11 | { 12 | [AphidProperty("name")] 13 | public string Name { get; set; } 14 | 15 | [AphidProperty("operators")] 16 | public string[] Operators { get; set; } 17 | 18 | [AphidProperty("operand")] 19 | public string Operand { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AphidCodeGenerator/AphidCodeGenerator.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /AphidCodeGenerator/AphidLexerGenerator.cs: -------------------------------------------------------------------------------- 1 | using Components; 2 | using System; 3 | using System.CodeDom; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace AphidCodeGenerator 11 | { 12 | class AphidLexerGenerator : IAphidCodeObject 13 | { 14 | public string CodeFile 15 | { 16 | get { { return @"Lexer\AphidLexer.cs"; } } 17 | } 18 | 19 | public System.CodeDom.CodeObject CreateCodeObject() 20 | { 21 | var llex = PathHelper.GetExecutingPath("llex.exe"); 22 | var tmpFile = Path.GetTempFileName(); 23 | 24 | AppDomain.CurrentDomain.ExecuteAssembly( 25 | llex, 26 | new[] 27 | { 28 | "Aphid.alx", 29 | tmpFile 30 | }); 31 | 32 | var snippet = new CodeSnippetCompileUnit(File.ReadAllText(tmpFile)); 33 | File.Delete(tmpFile); 34 | return snippet; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /AphidCodeGenerator/AphidParserRules.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Interpreter; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AphidCodeGenerator 9 | { 10 | public class AphidParserRules 11 | { 12 | [AphidProperty("binOpExps")] 13 | public AphidBinaryOperatorExpressionRule[] BinaryOperatorExpressions { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AphidCodeGenerator/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AphidCodeGenerator/IAphidCodeObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.CodeDom; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace AphidCodeGenerator 9 | { 10 | public interface IAphidCodeObject 11 | { 12 | string CodeFile { get; } 13 | CodeObject CreateCodeObject(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /AphidCodeGenerator/Program.cs: -------------------------------------------------------------------------------- 1 | using Components; 2 | using System.IO; 3 | using System.Linq; 4 | 5 | namespace AphidCodeGenerator 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | new PluginLoader() 12 | .Load() 13 | .Select(x => new 14 | { 15 | File = x.CodeFile, 16 | Code = CSharpHelper.GenerateCode(x.CreateCodeObject()) 17 | }) 18 | .Iter(x => File.WriteAllText(Path.Combine(args[0], x.File), x.Code)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell.AboutBoxPackage/AphidVSShell.AboutBoxPackage.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell.AboutBoxPackage/Guids.cs: -------------------------------------------------------------------------------- 1 | // Guids.cs 2 | // MUST match guids.h 3 | using System; 4 | 5 | namespace AphidVSShell.AboutBoxPackage 6 | { 7 | static class GuidList 8 | { 9 | public const string guidAboutBoxPackagePkgString = "8f0310b2-1205-40d2-b636-89f030e375b5"; 10 | public const string guidAboutBoxPackageCmdSetString = "9583b111-0359-43db-bd1e-8f9c4b87c87e"; 11 | 12 | public static readonly Guid guidAboutBoxPackageCmdSet = new Guid(guidAboutBoxPackageCmdSetString); 13 | }; 14 | } -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell.AboutBoxPackage/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell.AboutBoxPackage/Key.snk -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell.AboutBoxPackage/PkgCmdID.cs: -------------------------------------------------------------------------------- 1 | // PkgCmdID.cs 2 | // MUST match PkgCmdID.h 3 | using System; 4 | 5 | namespace AphidVSShell.AboutBoxPackage 6 | { 7 | static class PkgCmdIDList 8 | { 9 | public const uint cmdidHelpAbout = 0x100; 10 | 11 | 12 | }; 13 | } -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell.AboutBoxPackage/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | About Box Package 6 | Information about AphidVSShell About Box package 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/AphidVSShell.Application.pkgdef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/AphidVSShell.Application.pkgdef -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/AphidVSShell.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/AphidVSShell.cpp -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/AphidVSShell.exe.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 5 | 6 | 7 | true 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/AphidVSShell.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/AphidVSShell.h -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/AphidVSShell.pkgdef: -------------------------------------------------------------------------------- 1 | [$Initialization$] 2 | "ApplicationExtensionsFolder" = "$RootFolder$\Extensions" 3 | "PkgDefSearchPath" = "$ShellFolder$\Common7\IDE\ShellExtensions; \ 4 | $ShellFolder$\Common7\IDE\CommonExtensions\Platform; \ 5 | $ShellFolder$\Common7\IDE\CommonExtensions\Microsoft\Editor; \ 6 | $ShellFolder$\Common7\IDE\CommonExtensions\Microsoft\TemplateProviders; \ 7 | $ShellFolder$\Common7\IDE\CommonExtensions\Microsoft\Diff; \ 8 | $ShellFolder$\Common7\IDE\CommonExtensions\Microsoft\ProjectWizards; \ 9 | $ShellFolder$\Common7\IDE\CommonExtensions\Microsoft\Language\CallHierarchy; \ 10 | $ApplicationExtensionsFolder$" 11 | "RegistryRoot" = "Software\My Company\AphidVSShell\1.0" 12 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/AphidVSShell.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/AphidVSShell.reg -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/AphidVSShell.vcxproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/ApplicationIcon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/ApplicationIcon.ico -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/DebuggerProxy.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/DebuggerProxy.dll -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/Documentation/Images/AppEnv.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/Documentation/Images/AppEnv.jpg -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/General.vssettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | false 11 | false 12 | true 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/Resource.h -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/ShellSection.cpp: -------------------------------------------------------------------------------- 1 | // ShellSection.cpp 2 | // Implementation file for functions used to ensure Isolated Shell executables 3 | // define a section used to mark them as such. 4 | 5 | #include "stdafx.h" 6 | #include "ShellSection.h" 7 | 8 | // "vsshell" section is used to mark the executable as being based on the Visual Studio Shell. 9 | #pragma section("vsshell", read, write) 10 | __declspec(allocate("vsshell")) 11 | int iVSShellSectionField = 0; 12 | 13 | // The objective of this function is to ensure the field above is used in code. 14 | // Otherwise, the compiler could optimize the section away in release builds. 15 | void InitializeVSShellSection() 16 | { 17 | iVSShellSectionField = 1; 18 | } 19 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/ShellSection.h: -------------------------------------------------------------------------------- 1 | // ShellSection.h 2 | // Include file for functions used to ensure Isolated Shell executables 3 | // define a section used to mark them as such. 4 | 5 | #pragma once 6 | 7 | void InitializeVSShellSection(); 8 | 9 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/Splash.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/Splash.bmp -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/VsSDK.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | Mixed 4 | 5 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/small.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/small.ico -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/stdafx.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/stdafx.cpp -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShell/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShell/stdafx.h -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShellUI/AphidVSShellUI.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShellUI/AphidVSShellUI.cpp -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShellUI/AphidVSShellUI.vcxproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /AphidVSShell/AphidVSShellUI/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/AphidVSShell/AphidVSShellUI/resource.h -------------------------------------------------------------------------------- /AphidVSShell/ShellExtensionsVSIX/ShellExtensionsVSIX.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /AphidVSShell/ShellExtensionsVSIX/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Shell VSIX manifest 6 | Core extensions for AphidVSShell 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Components.Aphid.Net/Components.Aphid.Net.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/AssignmentTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Tests.Integration 9 | { 10 | [TestFixture(Category = "AphidAssignment")] 11 | public class AssignmentTests : AphidTests 12 | { 13 | [Test] 14 | public void AssignmentTest() 15 | { 16 | AssertTrue("x = 1; ret x == 1;"); 17 | } 18 | 19 | [Test] 20 | public void AssignmentTest2() 21 | { 22 | AssertTrue("x = 1; y = x; y = 9; ret x == 1 && y == 9;"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/Components.Aphid.Tests.Integration.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/FunctionTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Tests.Integration 9 | { 10 | [TestFixture(Category = "AphidFunction")] 11 | public class FunctionTests : AphidTests 12 | { 13 | [Test] 14 | public void FunctionTest() 15 | { 16 | Assert9("sqr=@(x){ret x*x;}; ret sqr(3);"); 17 | } 18 | 19 | [Test] 20 | public void SingleLineFunctionTest() 21 | { 22 | AssertFoo("x = @()'foo'; ret x();"); 23 | } 24 | 25 | [Test] 26 | public void SingleLineFunctionTest2() 27 | { 28 | Assert9("sqr=@(x)x*x; ret sqr(3);"); 29 | } 30 | 31 | [Test] 32 | public void HigherOrderFunctionTest() 33 | { 34 | AssertFoo("call=@(x)x(); test=@()'foo'; ret call(test);"); 35 | } 36 | 37 | [Test] 38 | public void HigherOrderFunctionTest2() 39 | { 40 | Assert9("add=@(x)@(y)x+y; addFour=add(4); ret addFour(5);"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/InitTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Tests.Integration 9 | { 10 | [TestFixture(Category = "AphidTypeInit")] 11 | public class TypeInitTests : AphidTests 12 | { 13 | protected override bool LoadStd { get { return true; } } 14 | 15 | protected override bool LoadReflection { get { return true; } } 16 | 17 | [Test] 18 | public void LengthTest1() 19 | { 20 | Assert9("a={b:'aaaaaaaaa'}; x={y:'a'}; x.{'y'}=a.{'b'}; ret x.y.length();"); 21 | } 22 | 23 | [Test] 24 | public void LengthTest2() 25 | { 26 | Assert9("x='aaaaaaaaa'; y='a'; y=this.{'x'}; ret y.length();"); 27 | } 28 | 29 | [Test] 30 | public void LengthTest3() 31 | { 32 | Assert9("this.x='aaaaaaaaa'; this.y='a'; y=this.{'x'}; ret y.length();"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/LiteralTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Tests.Integration 9 | { 10 | [TestFixture(Category = "AphidLiteral")] 11 | public class LiteralTests : AphidTests 12 | { 13 | [Test] 14 | public void NumberTest() 15 | { 16 | Assert9("ret 9;"); 17 | } 18 | 19 | [Test] 20 | public void HexNumberTest() 21 | { 22 | Assert9("ret 0x9;"); 23 | } 24 | 25 | [Test] 26 | public void HexNumberTest2() 27 | { 28 | Assert9("ret 0xA - 0x1;"); 29 | } 30 | 31 | [Test] 32 | public void HexNumberTest3() 33 | { 34 | Assert9("ret 0xf - 0x6;"); 35 | } 36 | 37 | [Test] 38 | public void HexNumberTest4() 39 | { 40 | AssertEquals(0, "ret 0x0;"); 41 | } 42 | 43 | [Test] 44 | public void StringTest() 45 | { 46 | AssertFoo("ret 'foo';"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/LoopTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Tests.Integration 9 | { 10 | [TestFixture(Category = "AphidLoop")] 11 | public class LoopTests : AphidTests 12 | { 13 | [Test] 14 | public void ForTest() 15 | { 16 | AssertFoo("c=['f','o','o']; s=''; for(x in c){s = s + x;} ret s;"); 17 | } 18 | 19 | [Test] 20 | public void ForTest2() 21 | { 22 | AssertFoo("c=['f','o','o']; s=''; for(x in c)s = s + x; ret s;"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/OperatorTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Tests.Integration 9 | { 10 | [TestFixture(Category = "AphidOperator")] 11 | public class OperatorTests : AphidTests 12 | { 13 | [Test] 14 | public void AssignmentTest() 15 | { 16 | AssertFoo("x='foo'; ret x;"); 17 | } 18 | 19 | [Test] 20 | public void AssignmentTest2() 21 | { 22 | AssertFoo("x='bar'; x='foo'; ret x;"); 23 | } 24 | 25 | [Test] 26 | public void StringConcatTest() 27 | { 28 | AssertFoo("ret 'fo'+'o';"); 29 | } 30 | 31 | [Test] 32 | public void AdditionTest() 33 | { 34 | Assert9("ret 2+7;"); 35 | } 36 | 37 | [Test] 38 | public void SubtractionTest() 39 | { 40 | Assert9("ret 11-2;"); 41 | } 42 | 43 | [Test] 44 | public void MultiplicationTest() 45 | { 46 | AssertEquals(20m, "ret 10*2;"); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/PropertyTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Tests.Integration 9 | { 10 | [TestFixture(Category = "AphidProperties")] 11 | public class PropertyTests : AphidTests 12 | { 13 | [Test] 14 | public void PropertyGetTest() 15 | { 16 | AssertFoo("x={y:'foo'}; ret x.y;"); 17 | } 18 | 19 | [Test] 20 | public void PropertyGetTest2() 21 | { 22 | AssertFoo("x={y:{z:{a:{b:{c:'foo'}}}}}; ret x.y.z.a.b.c;"); 23 | } 24 | 25 | [Test] 26 | public void PropertySetTest() 27 | { 28 | AssertFoo("x={}; x.y='foo'; ret x.y;"); 29 | } 30 | 31 | [Test] 32 | public void PropertySetTest2() 33 | { 34 | AssertFoo("x={y:'bar'}; x.y='foo'; ret x.y;"); 35 | } 36 | 37 | [Test] 38 | public void PropertySetTest3() 39 | { 40 | AssertFoo("x={y:{z:{}}}; x.y.z.a='foo'; ret x.y.z.a;"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Components.Aphid.Tests.Integration/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/Components.Aphid.VSPackage.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Program 5 | C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe 6 | /rootsuffix Exp 7 | 8 | 9 | Program 10 | C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe 11 | /rootsuffix Exp 12 | 13 | -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // This file is used by Code Analysis to maintain SuppressMessage 2 | // attributes that are applied to this project. Project-level 3 | // suppressions either have no target or are given a specific target 4 | // and scoped to a namespace, type, member, etc. 5 | // 6 | // To add a suppression to this file, right-click the message in the 7 | // Error List, point to "Suppress Message(s)", and click "In Project 8 | // Suppression File". You do not need to add suppressions to this 9 | // file manually. 10 | 11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] 12 | -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/Guids.cs: -------------------------------------------------------------------------------- 1 | // Guids.cs 2 | // MUST match guids.h 3 | using System; 4 | 5 | namespace Components.Aphid.VSPackage 6 | { 7 | static class GuidList 8 | { 9 | public const string guidAphidPackagePkgString = "fe11c5b2-f1f0-49a9-bddc-f2c829aa4922"; 10 | public const string guidAphidPackageCmdSetString = "ff925d28-a192-4801-ab9b-dbca5eb905b7"; 11 | 12 | public static readonly Guid guidAphidPackageCmdSet = new Guid(guidAphidPackageCmdSetString); 13 | }; 14 | } -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/Components.Aphid.VSPackage/Key.snk -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Resources; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("AphidPackage")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Company")] 14 | [assembly: AssemblyProduct("AphidPackage")] 15 | [assembly: AssemblyCopyright("")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | [assembly: ComVisible(false)] 19 | [assembly: CLSCompliant(false)] 20 | [assembly: NeutralResourcesLanguage("en-US")] 21 | 22 | // Version information for an assembly consists of the following four values: 23 | // 24 | // Major Version 25 | // Minor Version 26 | // Build Number 27 | // Revision 28 | // 29 | // You can specify all the values or you can default the Revision and Build Numbers 30 | // by using the '*' as shown below: 31 | 32 | [assembly: AssemblyVersion("1.0.0.0")] 33 | [assembly: AssemblyFileVersion("1.0.0.0")] 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/Resources/Package.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/Components.Aphid.VSPackage/Resources/Package.ico -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Aphid 6 | Information about my package 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Components.Aphid.VSPackage/todo.txt: -------------------------------------------------------------------------------- 1 | Create isolated shell -------------------------------------------------------------------------------- /Components.Aphid/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Components.Aphid/Components.Aphid.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/AphidFunction.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Parser; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Interpreter 9 | { 10 | public class AphidFunction 11 | { 12 | public string[] Args { get; set; } 13 | 14 | public List Body { get; set; } 15 | 16 | public AphidObject ParentScope { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/AphidInteropFunctionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Interpreter 4 | { 5 | [AttributeUsage(AttributeTargets.Method)] 6 | public class AphidInteropFunctionAttribute : Attribute 7 | { 8 | public string Name { get; set; } 9 | 10 | public bool PassInterpreter { get; set; } 11 | 12 | public bool UnwrapParameters { get; set; } 13 | 14 | public AphidInteropFunctionAttribute (string name) 15 | { 16 | UnwrapParameters = true; 17 | Name = name; 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/AphidLibraryAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Interpreter 4 | { 5 | [AttributeUsage(AttributeTargets.Class)] 6 | public class AphidLibraryAttribute : Attribute 7 | { 8 | public string Name { get; set; } 9 | 10 | public AphidLibraryAttribute (string name) 11 | { 12 | Name = name; 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/AphidObjectConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Interpreter 7 | { 8 | public static class AphidObjectConverter 9 | { 10 | public static string[] ToStringArray(AphidObject obj) 11 | { 12 | return (obj.Value as List).Select(x => (string)x.Value).ToArray(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/AphidPropertyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Interpreter 7 | { 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class AphidPropertyAttribute : Attribute 10 | { 11 | public string Name { get; set; } 12 | 13 | public AphidPropertyAttribute() 14 | { 15 | } 16 | 17 | public AphidPropertyAttribute(string name) 18 | : base() 19 | { 20 | Name = name; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/AphidRef.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Aphid.Interpreter 8 | { 9 | public class AphidRef 10 | { 11 | public string Name { get; set; } 12 | 13 | public AphidObject Object { get; set; } 14 | 15 | public AphidObject Get() 16 | { 17 | return Object[Name]; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/AphidScope.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Interpreter 4 | { 5 | public class AphidScope 6 | { 7 | public AphidScope Parent { get; set; } 8 | 9 | public AphidObject Variables { get; set; } 10 | 11 | public AphidScope () 12 | { 13 | } 14 | 15 | public AphidScope(AphidObject variables) 16 | { 17 | Variables = variables; 18 | } 19 | 20 | public AphidScope(AphidObject variables, AphidScope parent) 21 | : this(variables) 22 | { 23 | Parent = parent; 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/IAphidBindable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Interpreter 7 | { 8 | public interface IAphidBindable 9 | { 10 | void OnBinding(AphidObject source); 11 | void OnBound(AphidObject source); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/InterpreterException.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Lexer; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Components.Aphid.Interpreter 8 | { 9 | public class InterpreterException : Exception 10 | { 11 | public string Message { get; set; } 12 | 13 | public AphidToken Token { get; set; } 14 | 15 | public InterpreterException() 16 | { 17 | } 18 | 19 | public InterpreterException(string message, AphidToken token) 20 | { 21 | Message = message; 22 | Token = token; 23 | } 24 | 25 | public override string ToString() 26 | { 27 | return string.Format("{0} at {1}", Message, Token); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Components.Aphid/Interpreter/ValueHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Interpreter 7 | { 8 | public static class ValueHelper 9 | { 10 | public static object Unwrap(object obj) 11 | { 12 | AphidObject aphidObj; 13 | 14 | return (aphidObj = obj as AphidObject) != null ? aphidObj.Value : obj; 15 | } 16 | 17 | public static AphidObject Wrap(object obj) 18 | { 19 | AphidObject aphidObj; 20 | 21 | return (aphidObj = obj as AphidObject) != null ? aphidObj : new AphidObject(obj); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Components.Aphid/Library/Conversion.alx: -------------------------------------------------------------------------------- 1 | strToHex = @(x) x.chars().map(hexb).addAll(); 2 | 3 | urlEnc = @(x) x.chars().map(@(y) '%' + hexb(y)).addAll(); -------------------------------------------------------------------------------- /Components.Aphid/Library/Dbg.alx: -------------------------------------------------------------------------------- 1 | ##'Components.Aphid.Library.DebugLibrary'; 2 | 3 | dbg.enabled = false; 4 | dbg.enable = @() dbg.enabled = true; 5 | dbg.disable = @() dbg.enabled = false; 6 | 7 | dbg.code = @(f) { 8 | if (dbg.enabled) f(); 9 | }; -------------------------------------------------------------------------------- /Components.Aphid/Library/DebugLibrary.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Interpreter; 2 | using System; 3 | using System.Linq; 4 | using System.IO; 5 | using System.Collections.Generic; 6 | using System.Diagnostics; 7 | 8 | namespace Components.Aphid.Library 9 | { 10 | [AphidLibraryAttribute("dbg.breakpoint")] 11 | public class DebugLibrary 12 | { 13 | [AphidInteropFunction("dbg.breakpoint")] 14 | private static void DebuggerBreak() 15 | { 16 | Debugger.Break(); 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Components.Aphid/Library/Env.alx: -------------------------------------------------------------------------------- 1 | ##'Components.Aphid.Library.EnvironmentLibrary'; 2 | 3 | createDefaultArgObj = @(argConfig) { 4 | argObj = {}; 5 | argConfig.iter(@(x) { 6 | if (x.default?) { 7 | argObj.{x.arg} = x.default; 8 | } else if (!(x.hasValue?) || !x.hasValue) { 9 | argObj.{x.arg} = false; 10 | } 11 | }); 12 | ret argObj; 13 | }; 14 | 15 | env.readArgs = @(argConfig) { 16 | argObj = createDefaultArgObj(argConfig); 17 | 18 | args = env.args().skip(1); 19 | 20 | for (i = 0; i < args.count(); i++) { 21 | a = args[i]; 22 | 23 | for (j = 0; j < argConfig.count(); j++) { 24 | ac = argConfig[j]; 25 | if ('-' + ac.arg == a) { 26 | v; 27 | if (ac.hasValue? && ac.hasValue) { 28 | i++; 29 | v = args[i]; 30 | } else { 31 | v = true; 32 | } 33 | 34 | //reflection.mix(v, argObj.{ac.arg}); 35 | //__initString(v); 36 | argObj.{ac.arg} = v; 37 | } 38 | } 39 | } 40 | 41 | ret argObj; 42 | }; 43 | 44 | env.exec = @(exe, args, opts) env.execInternal(exe, args, opts); -------------------------------------------------------------------------------- /Components.Aphid/Library/IO.alx: -------------------------------------------------------------------------------- 1 | ##'Components.Aphid.Library.IOLibrary'; 2 | 3 | getFsos = @(f, dir, opt) { 4 | filter = '*'; 5 | recurse = false; 6 | 7 | if (opt?) { 8 | if (opt.filter?) filter = opt.filter; 9 | if (opt.recurse?) recurse = opt.recurse; 10 | } 11 | 12 | ret f(dir, filter, recurse); 13 | }; 14 | 15 | io.dir.getFiles = @getFsos(io.dir.getFilesInternal); 16 | io.dir.getDirs = @getFsos(io.dir.getDirsInternal); -------------------------------------------------------------------------------- /Components.Aphid/Library/Reflection.alx: -------------------------------------------------------------------------------- 1 | ##'Components.Aphid.Library.ReflectionLibrary'; 2 | #'Dbg'; 3 | 4 | reflection.mix = @(src, dst) { 5 | for (m in reflection.members(src)) { 6 | dst.{m} = src.{m}; 7 | reflection.mix(src.{m}, dst.{m}); 8 | } 9 | }; 10 | 11 | reflection.getMember = @(obj, path) { 12 | val = obj; 13 | parts = path.split('.'); 14 | 15 | for (p in parts) { 16 | val = val.{p}; 17 | } 18 | 19 | ret val; 20 | }; -------------------------------------------------------------------------------- /Components.Aphid/Library/ReflectionLibrary.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Interpreter; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Components.Aphid.Library 8 | { 9 | [AphidLibrary("reflection")] 10 | public class ReflectionLibrary 11 | { 12 | [AphidInteropFunction("reflection.members", UnwrapParameters = false)] 13 | public static List Members(AphidObject obj) 14 | { 15 | return obj.Select(x => new AphidObject(x.Key)).ToList(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Components.Aphid/Library/Std.alx: -------------------------------------------------------------------------------- 1 | ##'Components.Aphid.Library.StandardLibrary'; 2 | #'String'; 3 | #'List'; 4 | #'Conversion'; 5 | 6 | -------------------------------------------------------------------------------- /Components.Aphid/Library/String.alx: -------------------------------------------------------------------------------- 1 | __initString = @(s) { 2 | s.chars = @() __string.getChars(s); 3 | s.split = @(separator) __string.split(s, separator); 4 | s.isMatch = @(pattern) __string.isMatch(s, pattern); 5 | s.length = @() __string.length(s); 6 | s.remove = @(index) __string.remove(s, index); 7 | s.substring = @(index, length) __string.substring(s, index, length); 8 | s.startsWith = @(value) __string.startsWith(s, value); 9 | s.endsWith = @(value) __string.endsWith(s, value); 10 | }; -------------------------------------------------------------------------------- /Components.Aphid/Library/Threading.alx: -------------------------------------------------------------------------------- 1 | ##'Components.Aphid.Library.ThreadingLibrary'; -------------------------------------------------------------------------------- /Components.Aphid/Parser/AphidNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Parser 4 | { 5 | public abstract class AphidNode 6 | { 7 | 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/AphidNodeCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Components.Aphid.Parser 5 | { 6 | public abstract class AphidNodeCollection : AphidNode 7 | where TNodeType : AphidNode 8 | { 9 | private List _nodes = new List(); 10 | 11 | public List Nodes 12 | { 13 | get { return _nodes; } 14 | set { _nodes = value; } 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/AphidParserException.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Lexer; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Components.Aphid.Parser 8 | { 9 | public class AphidParserException : Exception 10 | { 11 | public AphidToken Token { get; set; } 12 | 13 | public AphidParserException(AphidToken token) 14 | { 15 | Token = token; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/AphidRuntimeException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class AphidRuntimeException : Exception 9 | { 10 | public AphidRuntimeException(string message, params object[] args) 11 | : base(string.Format(message, args)) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ArrayAccessExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Parser 4 | { 5 | public class ArrayAccessExpression : Expression 6 | { 7 | public Expression ArrayExpression { get; set; } 8 | 9 | public Expression KeyExpression { get; set; } 10 | 11 | public ArrayAccessExpression () 12 | { 13 | } 14 | 15 | public ArrayAccessExpression(Expression arrayExpression, Expression keyExpression) 16 | { 17 | ArrayExpression = arrayExpression; 18 | KeyExpression = keyExpression; 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ArrayExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class ArrayExpression : Expression 9 | { 10 | public List Elements { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/BooleanExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Aphid.Parser 8 | { 9 | public class BooleanExpression : Expression 10 | { 11 | public bool Value { get; set; } 12 | 13 | public BooleanExpression() 14 | { 15 | } 16 | 17 | public BooleanExpression(bool value) 18 | { 19 | Value = value; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/BreakExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class BreakExpression : Expression 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/CallExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class CallExpression : Expression 9 | { 10 | public Expression FunctionExpression { get; set; } 11 | 12 | public IEnumerable Args { get; set; } 13 | 14 | public CallExpression(Expression functionExpression, IEnumerable args) 15 | { 16 | FunctionExpression = functionExpression; 17 | Args = args; 18 | } 19 | 20 | public CallExpression(Expression functionExpression) 21 | : this (functionExpression, new Expression[0]) 22 | { 23 | 24 | } 25 | 26 | public CallExpression(Expression functionExpression, Expression expression) 27 | : this(functionExpression, new[] { expression }) 28 | { 29 | } 30 | 31 | public override string ToString() 32 | { 33 | return string.Format("{0}({1})", FunctionExpression, Args.Select(x => x.ToString()).DefaultIfEmpty().Aggregate((x, y) => x + ", " + y)); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ControlFlowStatement.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Lexer; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Parser 9 | { 10 | public class ControlFlowExpression : Expression 11 | { 12 | public AphidTokenType Type { get; set; } 13 | 14 | public Expression Condition { get; set; } 15 | 16 | public List Body { get; set; } 17 | 18 | public ControlFlowExpression(AphidTokenType type, Expression condition, List body) 19 | { 20 | Type = type; 21 | Condition = condition; 22 | Body = body; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/DynamicMemberExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Parser 4 | { 5 | public class DynamicMemberExpression : Expression 6 | { 7 | public Expression MemberExpression { get; set; } 8 | 9 | public DynamicMemberExpression () 10 | { 11 | } 12 | 13 | public DynamicMemberExpression (Expression memberExpression) 14 | { 15 | MemberExpression = memberExpression; 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ElseExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Components.Aphid.Parser 5 | { 6 | public class ElseExpression 7 | { 8 | public List Body { get; set; } 9 | 10 | public ElseExpression() 11 | { 12 | } 13 | 14 | public ElseExpression(List body) 15 | { 16 | Body = body; 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/Expression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Parser 4 | { 5 | public class Expression : AphidNode 6 | { 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ForEachExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Components.Aphid.Parser 5 | { 6 | public class ForEachExpression : Expression 7 | { 8 | public Expression Collection { get; set; } 9 | 10 | public Expression Element { get; set; } 11 | 12 | public List Body { get; set; } 13 | 14 | public ForEachExpression (Expression collection, Expression element, List body) 15 | { 16 | Collection = collection; 17 | Element = element; 18 | Body = body; 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ForExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class ForExpression : Expression 9 | { 10 | public Expression Initialization { get; set; } 11 | 12 | public Expression Condition { get; set; } 13 | 14 | public Expression Afterthought { get; set; } 15 | 16 | public List Body { get; set; } 17 | 18 | public ForExpression( 19 | Expression initialization, 20 | Expression condition, 21 | Expression afterthought, 22 | List body) 23 | { 24 | Initialization = initialization; 25 | Condition = condition; 26 | Afterthought = afterthought; 27 | Body = body; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/FunctionExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Aphid.Parser 8 | { 9 | public class FunctionExpression : Expression 10 | { 11 | public List Args { get; set; } 12 | 13 | public List Body { get; set; } 14 | 15 | public override string ToString () 16 | { 17 | return string.Format ("@({0}) {{ {1} }}", 18 | Args.Select(x => x.ToString()).DefaultIfEmpty().Aggregate((x, y) => x + " " + y), 19 | Body.Select(x => x.ToString()).DefaultIfEmpty().Aggregate((x, y) => x + " " + y)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/IdentifierExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class IdentifierExpression : Expression 9 | { 10 | public string Identifier { get; set; } 11 | 12 | public IdentifierExpression(string identifier) 13 | { 14 | Identifier = identifier; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return Identifier; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/IfExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Components.Aphid.Lexer; 4 | 5 | namespace Components.Aphid.Parser 6 | { 7 | public class IfExpression : ControlFlowExpression 8 | { 9 | public List ElseBody { get; set; } 10 | 11 | public IfExpression(Expression condition, List body, List elseBody) 12 | : base(AphidTokenType.ifKeyword, condition, body) 13 | { 14 | ElseBody = elseBody; 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/LoadLibraryExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class LoadLibraryExpression : Expression 9 | { 10 | public Expression LibraryExpression { get; set; } 11 | 12 | public LoadLibraryExpression(Expression libraryExpression) 13 | { 14 | LibraryExpression = libraryExpression; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/LoadScriptExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class LoadScriptExpression : Expression 9 | { 10 | public Expression FileExpression { get; set; } 11 | 12 | public LoadScriptExpression(Expression fileExpression) 13 | { 14 | FileExpression = fileExpression; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/MemberExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Aphid.Parser 8 | { 9 | public class MemberExpression : Expression 10 | { 11 | public IdentifierExpression Variable { get; set; } 12 | public List Members { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/NullExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class NullExpression : Expression 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/NumberExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Parser 4 | { 5 | public class NumberExpression : Expression 6 | { 7 | public decimal Value { get; set; } 8 | 9 | public NumberExpression(decimal value) 10 | { 11 | Value = value; 12 | } 13 | 14 | public override string ToString () 15 | { 16 | return Value.ToString (); 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ObjectExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Aphid.Parser 8 | { 9 | public class ObjectExpression : Expression 10 | { 11 | public List Pairs { get; set; } 12 | 13 | public override string ToString() 14 | { 15 | return string.Format( 16 | "{{ {0} }}", 17 | Pairs 18 | .DefaultIfEmpty() 19 | .Select(x => x.ToString()) 20 | .Aggregate((x, y) => x + ", " + y)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/PartialFunctionExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class PartialFunctionExpression : Expression 9 | { 10 | public CallExpression Call { get; set; } 11 | 12 | public PartialFunctionExpression() 13 | { 14 | } 15 | 16 | public PartialFunctionExpression(CallExpression call) 17 | { 18 | Call = call; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/PatternMatchingExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class PatternMatchingExpression : Expression 9 | { 10 | public Expression TestExpression { get; set; } 11 | 12 | public List> Patterns { get; set; } 13 | 14 | public PatternMatchingExpression() 15 | { 16 | Patterns = new List>(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/Statement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Components.Aphid.Parser 4 | { 5 | public class Statement : AphidNode 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /Components.Aphid/Parser/StringExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class StringExpression : ValueExpression 9 | { 10 | public StringExpression(string value) 11 | : base(value) 12 | { 13 | } 14 | 15 | public override string ToString() 16 | { 17 | return Value; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ThisExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class ThisExpression : Expression 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/UnaryOperatorExpression.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Lexer; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Aphid.Parser 9 | { 10 | public class UnaryOperatorExpression : Expression 11 | { 12 | public AphidTokenType Operator { get; set; } 13 | 14 | public Expression Operand { get; set; } 15 | 16 | public bool IsPostfix { get; set; } 17 | 18 | public UnaryOperatorExpression(AphidTokenType op, Expression operand) 19 | { 20 | Operator = op; 21 | Operand = operand; 22 | } 23 | 24 | public override string ToString () 25 | { 26 | return IsPostfix ? 27 | string.Format ("{0} {1}", Operand, Operator) : 28 | string.Format ("{0} {1}", Operator, Operand); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Components.Aphid/Parser/ValueExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.Aphid.Parser 7 | { 8 | public class ValueExpression : Expression 9 | { 10 | public TValue Value { get; set; } 11 | 12 | public ValueExpression(TValue value) 13 | { 14 | Value = value; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return Value.ToString(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Components.Aphid/Todo.txt: -------------------------------------------------------------------------------- 1 | Bin ops (+=, -=, etc) 2 | Regex support 3 | AOP 4 | Pattern matching 5 | string lower, upper 6 | Inline XML, XML deserialization 7 | Attributes 8 | Reflection 9 | Exception handling 10 | Assignment tests x=x x=y 11 | Command line args -------------------------------------------------------------------------------- /Components.ConsolePlus/CliLexerState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.ConsolePlus 7 | { 8 | /// 9 | /// An enumeration that represents the state of the lexer. 10 | /// 11 | public enum CliLexerState 12 | { 13 | /// 14 | /// Represents the text reading state 15 | /// 16 | ReadingText, 17 | 18 | /// 19 | /// Represents the token reading state 20 | /// 21 | ReadingToken, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Components.ConsolePlus/Components.ConsolePlus.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /Components.ConsolePlus/DumpMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components.ConsolePlus 7 | { 8 | public enum DumpMode 9 | { 10 | Table, 11 | Details, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Components.Net/Components.Net.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /Components.Net/Http/ContentDisposition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public class ContentDisposition 10 | { 11 | public const string FormData = "form-data"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Components.Net/Http/FieldValuePair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public class FieldValuePair 10 | { 11 | public string Field { get; set; } 12 | 13 | public string Value { get; set; } 14 | 15 | public FieldValuePair() 16 | { 17 | } 18 | 19 | public FieldValuePair(string field, string value) 20 | { 21 | Field = field; 22 | Value = value; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Components.Net/Http/FormData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Net.Http 9 | { 10 | public class FormData : HttpMessagePart 11 | { 12 | public string Header { get; private set; } 13 | 14 | public string StringValue { get; set; } 15 | 16 | public HttpUpload UploadValue { get; set; } 17 | 18 | public FormData(string value) 19 | { 20 | StringValue = value; 21 | } 22 | 23 | public FormData(HttpUpload value) 24 | { 25 | UploadValue = value; 26 | } 27 | 28 | public void SetHeader() 29 | { 30 | Header = GetAttributeString() + "\r\n\r\n"; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Components.Net/Http/FormUrlEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public static class FormUrlEncoder 10 | { 11 | public static string Encode(IEnumerable pairs) 12 | { 13 | return pairs 14 | .Select(x => 15 | Uri.EscapeDataString(x.Field) + 16 | "=" + 17 | Uri.EscapeDataString(x.Value)) 18 | .Aggregate((x, y) => x + "&" + y); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Components.Net/Http/HttpConnection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public static class HttpConnection 10 | { 11 | public const string KeepAlive = "Keep-Alive"; 12 | public const string Close = "close"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Components.Net/Http/HttpField.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public static class HttpField 10 | { 11 | public const string Host = "Host"; 12 | public const string ContentType = "Content-Type"; 13 | public const string ContentLength = "Content-Length"; 14 | public const string UserAgent = "User-Agent"; 15 | public const string ContentDisposition = "Content-Disposition"; 16 | public const string Accept = "Accept"; 17 | public const string Connection = "Connection"; 18 | public const string TransferEncoding = "Transfer-Encoding"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Components.Net/Http/HttpMethod.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public static class HttpMethod 10 | { 11 | public const string Get = "GET"; 12 | public const string Head = "HEAD"; 13 | public const string Post = "POST"; 14 | public const string PUT = "PUT"; 15 | public const string Delete = "DELETE"; 16 | public const string Trace = "TRACE"; 17 | public const string Options = "OPTIONS"; 18 | public const string Connect = "CONNECT"; 19 | public const string Patch = "PATCH"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Components.Net/Http/HttpResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Net.Http 9 | { 10 | public class HttpResponse : HttpMessagePart 11 | { 12 | public bool IsChunked { get; set; } 13 | 14 | public Stream BodyStream { get; set; } 15 | 16 | public string GetBodyString() 17 | { 18 | BodyStream.Position = 0; 19 | 20 | Stream stream; 21 | 22 | if (IsChunked) 23 | { 24 | stream = new MemoryStream(); 25 | ChunkedTransferEncoding.Decode(BodyStream, stream); 26 | } 27 | else 28 | { 29 | stream = BodyStream; 30 | } 31 | 32 | return new StreamReader(stream).ReadToEnd(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Components.Net/Http/HttpUpload.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components.Net.Http 9 | { 10 | public class HttpUpload 11 | { 12 | public string Name { get; set; } 13 | 14 | public string Filename { get; set; } 15 | 16 | public string FileMimeType { get; set; } 17 | 18 | public Stream Stream { get; set; } 19 | 20 | public HttpUpload() 21 | { 22 | FileMimeType = MimeType.ApplicationOctetStream; 23 | } 24 | 25 | public HttpUpload(string name, string filename, Stream stream) 26 | : this() 27 | { 28 | Name = name; 29 | Filename = filename; 30 | Stream = stream; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Components.Net/Http/HttpVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public static class HttpVersion 10 | { 11 | public const string V10 = "1.0"; 12 | public const string V11 = "1.1"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Components.Net/Http/MimeType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components.Net.Http 8 | { 9 | public static class MimeType 10 | { 11 | public const string ApplicationOctetStream = "application/octet-stream"; 12 | public const string Multipart = "multipart/form-data"; 13 | public const string FormUrlEncoded = "application/x-www-form-urlencoded"; 14 | public const string TextPlain = "text/plain"; 15 | public const string TextHtml = "text/html"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Components/ByteArrayExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace Components 8 | { 9 | public static class ByteArrayExtension 10 | { 11 | private static Encoding _encoding = Encoding.GetEncoding("iso-8859-1"); 12 | 13 | public static string GetString(this byte[] Bytes) 14 | { 15 | return _encoding.GetString(Bytes); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Components/CodeExpressionExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.CodeDom; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components 9 | { 10 | public static class CodeExpressionExtension 11 | { 12 | public static CodePropertyReferenceExpression GetProperty(this CodeExpression expression, string name) 13 | { 14 | return new CodePropertyReferenceExpression(expression, name); 15 | } 16 | 17 | public static CodeMethodReferenceExpression GetMethod(this CodeExpression expression, string name) 18 | { 19 | return new CodeMethodReferenceExpression(expression, name); 20 | } 21 | 22 | public static CodeMethodInvokeExpression InvokeMethod( 23 | this CodeExpression expression, 24 | string name, 25 | params CodeExpression[] parameters) 26 | { 27 | return new CodeMethodReferenceExpression(expression, name).Invoke(parameters); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Components/CodeMemberMethodExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.CodeDom; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components 9 | { 10 | public static class CodeMemberMethodExtension 11 | { 12 | public static void AddParameter(this CodeMemberMethod method, Type type, string name) 13 | { 14 | method.Parameters.Add(new CodeParameterDeclarationExpression(type, name)); 15 | } 16 | 17 | public static void AddParameter(this CodeMemberMethod method, string type, string name) 18 | { 19 | method.Parameters.Add(new CodeParameterDeclarationExpression(type, name)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Components/CodeMethodReferenceExpressionExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.CodeDom; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components 9 | { 10 | public static class CodeMethodReferenceExpressionExtension 11 | { 12 | public static CodeMethodInvokeExpression Invoke(this CodeMethodReferenceExpression expression, params CodeExpression[] parameters) 13 | { 14 | return new CodeMethodInvokeExpression(expression, parameters); 15 | } 16 | 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Components/Components.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /Components/DictionaryExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components 7 | { 8 | public static class DictionaryExtension 9 | { 10 | public static TValue GetValueOrDefault(this Dictionary dictionary, TKey key) 11 | { 12 | return dictionary.ContainsKey(key) ? dictionary[key] : default(TValue); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Components/HashAlgorithmExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Security.Cryptography; 6 | 7 | namespace Components 8 | { 9 | public static class HashAlgorithmExtension 10 | { 11 | public static string ComputeHash(this HashAlgorithm Hash, string Buffer) 12 | { 13 | StringBuilder digestString = new StringBuilder(); 14 | 15 | foreach (byte b in Hash.ComputeHash(ASCIIEncoding.ASCII.GetBytes(Buffer))) 16 | digestString.Append(Convert.ToString(b, 16).PadLeft(2, '0')); 17 | 18 | return digestString.ToString(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Components/IServiceLocator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Components 8 | { 9 | public interface IServiceLocator 10 | { 11 | bool IsRegistered(); 12 | void Register(TService service); 13 | TService Resolve(); 14 | TService ResolveOrCreate(Func create); 15 | TService ResolveOrCreate() where TService : new(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Components/ItemEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components 7 | { 8 | public class ItemEventArgs : EventArgs 9 | { 10 | public TItem Item { get; set; } 11 | 12 | public ItemEventArgs(TItem item) 13 | { 14 | Item = item; 15 | } 16 | 17 | public ItemEventArgs() { } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Components/PluginLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Components 9 | { 10 | public class PluginLoader 11 | { 12 | public IEnumerable Load(Assembly asm) 13 | { 14 | return asm 15 | .GetTypes() 16 | .Where(x => x.IsDerivedFromOrImplements()) 17 | .Select(Activator.CreateInstance) 18 | .Cast(); 19 | } 20 | 21 | public IEnumerable Load() 22 | { 23 | return Load(Assembly.GetCallingAssembly()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Components/StringEnumerableExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components 7 | { 8 | public static class StringEnumerableExtension 9 | { 10 | public static string Join(this IEnumerable source, string delimiter) 11 | { 12 | return source.Aggregate((x, y) => x + delimiter + y); 13 | } 14 | 15 | public static string Join(this IEnumerable source) 16 | { 17 | return source.Join(""); 18 | } 19 | 20 | public static string JoinLines(this IEnumerable source) 21 | { 22 | return source.Join("\r\n"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Components/WebClientHelperResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Components 7 | { 8 | public class WebClientHelperResponse 9 | { 10 | public string Info { get; private set; } 11 | 12 | public byte[] Data { get; private set; } 13 | 14 | public WebClientHelperResponse(string info, byte[] data) 15 | { 16 | Info = info; 17 | Data = data; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Components/XmlSerializerExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Xml.Serialization; 7 | 8 | namespace Components 9 | { 10 | public static class XmlSerializerExtensions 11 | { 12 | public static void Serialize(this XmlSerializer Serializer, string Filename, object o) 13 | { 14 | using (var s = File.Create(Filename)) 15 | Serializer.Serialize(s, o); 16 | } 17 | 18 | public static string Serialize(this XmlSerializer Serializer, object o) 19 | { 20 | using (var s = new MemoryStream()) 21 | { 22 | Serializer.Serialize(s, o); 23 | 24 | s.Position = 0; 25 | 26 | using (var reader = new StreamReader(s)) 27 | return reader.ReadToEnd(); 28 | } 29 | } 30 | 31 | public static object Deserialize(this XmlSerializer Serializer, string Filename) 32 | { 33 | using (var s = File.OpenRead(Filename)) 34 | return Serializer.Deserialize(s); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ComponentsUnitTests/ComponentsUnitTests.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /ComponentsUnitTests/UnitTest1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using Components; 5 | 6 | namespace ComponentsUnitTests 7 | { 8 | [TestClass] 9 | public class ExtensionUnitTests 10 | { 11 | [TestMethod, TestCategory("GeneralExtensions")] 12 | public void StringToBytesTestMethod() 13 | { 14 | var sb = new StringBuilder(); 15 | 16 | for (var i = 0; i < 256; i++) 17 | { 18 | sb.Append((char)i); 19 | } 20 | 21 | var s = sb.ToString(); 22 | var b = s.GetBytes(); 23 | 24 | for (var i = 0; i < 256; i++) 25 | { 26 | Assert.AreEqual((byte)i, b[i]); 27 | } 28 | } 29 | 30 | [TestMethod, TestCategory("GeneralExtensions")] 31 | public void BytesToStringTestMethod() 32 | { 33 | var b = new byte[256]; 34 | 35 | for (var i = 0; i < 256; i++) 36 | { 37 | b[i] = (byte)i; 38 | } 39 | 40 | var s = b.GetString(); 41 | 42 | for (var i = 0; i < 256; i++) 43 | { 44 | Assert.AreEqual((byte)i, (byte)s[i]); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LLex/BinaryExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public class BinaryExpression : RegexExpression 9 | { 10 | public RegexExpression Left { get; private set; } 11 | 12 | public RegexTokenType Operator { get; private set; } 13 | 14 | public RegexExpression Right { get; private set; } 15 | 16 | public BinaryExpression(RegexExpression left, RegexTokenType op, RegexExpression right) 17 | { 18 | Left = left; 19 | Operator = op; 20 | Right = right; 21 | } 22 | 23 | public override string ToString() 24 | { 25 | var op = Operator == RegexTokenType.OrOperator ? "|" : ""; 26 | 27 | return string.Format("{0}{1}{2}", Left, op, Right); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LLex/CharExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public class CharExpression : RegexExpression 9 | { 10 | public char Char { get; private set; } 11 | 12 | public CharExpression(char c) 13 | { 14 | Char = c; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return System.Text.RegularExpressions.Regex.Escape(Char.ToString()) + base.ToString(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /LLex/GroupExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public class GroupExpression : RegexExpression 9 | { 10 | public RegexExpression Expression { get; private set; } 11 | 12 | public GroupExpression(RegexExpression expression) 13 | { 14 | Expression = expression; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return string.Format("({0}){1}", Expression, base.ToString()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /LLex/LLex.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /LLex/LLexNameInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public class LLexNameInfo 9 | { 10 | public string FullName { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public string Namespace { get; set; } 15 | 16 | public string LexerName { get; set; } 17 | 18 | public string TokenName { get; set; } 19 | 20 | public string TokenTypeName { get; set; } 21 | 22 | public static LLexNameInfo Parse(string fullName) 23 | { 24 | var lastDot = fullName.LastIndexOf('.'); 25 | string name = fullName.Substring(lastDot + 1); 26 | 27 | return new LLexNameInfo() 28 | { 29 | FullName = fullName, 30 | Name = name, 31 | Namespace = fullName.Remove(lastDot), 32 | LexerName = name + "Lexer", 33 | TokenName = name + "Token", 34 | TokenTypeName = name + "TokenType", 35 | }; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LLex/LexFileMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public enum LexFileMode 9 | { 10 | Normal, 11 | Code, 12 | Keyword, 13 | KeywordDefault, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LLex/LexerState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public class LexerState 9 | { 10 | public char State { get; set; } 11 | public string Token { get; set; } 12 | public string Code { get; set; } 13 | public int? NewMode { get; set; } 14 | public List Children { get; set; } 15 | 16 | public LexerState(char state, string token, List children) 17 | { 18 | State = state; 19 | Token = token; 20 | Children = children; 21 | } 22 | 23 | public LexerState(char state, string token) 24 | : this(state, token, null) 25 | { 26 | } 27 | 28 | public LexerState(List children) 29 | : this((char)0, "None", children) 30 | { 31 | 32 | } 33 | 34 | public LexerState() 35 | : this((char)0, "None", new List()) 36 | { 37 | 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LLex/OperatorExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public class OperatorExpression : RegexExpression 9 | { 10 | public RegexTokenType Type { get; private set; } 11 | 12 | public OperatorExpression(RegexTokenType type) 13 | { 14 | Type = type; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LLex/RegexExpression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public abstract class RegexExpression : RegexNode 9 | { 10 | public RegexTokenType Quantifier { get; set; } 11 | 12 | public override string ToString() 13 | { 14 | return Quantifier == RegexTokenType.None ? "" : 15 | Quantifier == RegexTokenType.OneOrMoreQuantifier ? "+" : 16 | Quantifier == RegexTokenType.ZeroOrMoreQuantifier ? "*" : 17 | Quantifier == RegexTokenType.ZeroOrOneQuantifier ? "?" : 18 | "[Error]"; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /LLex/RegexNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public abstract class RegexNode 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LLex/Resources/AddTokenTemplate.cs: -------------------------------------------------------------------------------- 1 | var index = lastIndex + 1; 2 | var lexeme = text.Substring(index, charIndex - lastIndex); 3 | 4 | tokens.Add(new {Token}(tokenType, lexeme, index)); 5 | -------------------------------------------------------------------------------- /LLex/Resources/CaseTemplate.cs: -------------------------------------------------------------------------------- 1 | case '{{Char}}': 2 | {{States}} 3 | {{Body}} -------------------------------------------------------------------------------- /LLex/Resources/RootStateTemplate.cs: -------------------------------------------------------------------------------- 1 | if (charIndex < lastIndex) 2 | { 3 | currentChar = text[++charIndex]; 4 | 5 | switch (currentChar) 6 | { 7 | {{States}} 8 | } 9 | 10 | return {TokenType}.Unknown; 11 | } -------------------------------------------------------------------------------- /LLex/Resources/StateTemplate.cs: -------------------------------------------------------------------------------- 1 | if (charIndex < lastIndex) 2 | { 3 | currentChar = text[++charIndex]; 4 | 5 | switch (currentChar) 6 | { 7 | {{States}} 8 | } 9 | 10 | PreviousChar(); 11 | } -------------------------------------------------------------------------------- /LLex/TokenEntry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace LLex 7 | { 8 | public class TokenEntry 9 | { 10 | public int? NewMode { get; set; } 11 | public string Lexeme { get; set; } 12 | public string TokenType { get; set; } 13 | public string Code { get; set; } 14 | 15 | public TokenEntry(string lexeme, string tokenType, string code, int? newMode) 16 | { 17 | Lexeme = lexeme; 18 | NewMode = newMode; 19 | TokenType = tokenType; 20 | Code = code; 21 | } 22 | 23 | public TokenEntry(string lexeme, string tokenType) 24 | : this(lexeme, tokenType, null, null) 25 | { 26 | } 27 | 28 | public TokenEntry(string lexeme, string tokenType, string code) 29 | : this(lexeme, tokenType, code, null) 30 | { 31 | } 32 | 33 | public override string ToString() 34 | { 35 | return Lexeme; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LLex/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /LLex/regex.ll: -------------------------------------------------------------------------------- 1 | LLex.Regex 2 | 3 | Regex 4 | 5 | \( LeftParenthesis 6 | \) RightParenthesis 7 | \[ LeftBracket 8 | \] RightBracket 9 | \| OrOperator 10 | \? ZeroOrOneQuantifier 11 | \* ZeroOrMoreQuantifier 12 | \+ OneOrMoreQuantifier 13 | 14 | \\s SpecialCharacter 15 | \\r SpecialCharacter 16 | \\n SpecialCharacter 17 | \\t SpecialCharacter 18 | \\v SpecialCharacter 19 | 20 | \\\( Character 21 | \\\) Character 22 | \\\[ Character 23 | \\\] Character 24 | \\\| Character 25 | \\\? Character 26 | \\\* Character 27 | \\\+ Character 28 | \\\\ Character 29 | 30 | %% 31 | return RegexTokenType.Character; 32 | %% -------------------------------------------------------------------------------- /LexerTestGenerator/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LexerTestGenerator/LexerTestGenerator.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /LexerTestGenerator/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /MonoBuildScriptGenerator/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MonoBuildScriptGenerator/BuildScriptGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MonoBuildScriptGenerator 8 | { 9 | public abstract class BuildScriptGenerator 10 | { 11 | public abstract string CreateScript(Project project); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MonoBuildScriptGenerator/MonoBuildScriptGenerator.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /MonoBuildScriptGenerator/Project.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MonoBuildScriptGenerator 8 | { 9 | public class Project 10 | { 11 | public string CSProj { get; set; } 12 | public string OutFile { get; set; } 13 | public IEnumerable Reference { get; set; } 14 | public IEnumerable CompilationSymbols { get; set; } 15 | public IEnumerable Compile { get; set; } 16 | public IEnumerable Copies { get; set; } 17 | 18 | public Project( 19 | string csproj, 20 | IEnumerable reference, 21 | IEnumerable compile, 22 | string outFile = null, 23 | IEnumerable compilationSymbols = null, 24 | IEnumerable copies = null) 25 | { 26 | CSProj = csproj; 27 | OutFile = outFile; 28 | Reference = reference; 29 | Compile = compile; 30 | CompilationSymbols = compilationSymbols; 31 | Copies = copies; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /MonoBuildScriptGenerator/phpvh.cmd: -------------------------------------------------------------------------------- 1 | :: SourceDir must have trailing slash! 2 | SET SourceDir=C:\source\PhpVH\ 3 | MonoBuildScriptGenerator "%SourceDir%PhpVH\PhpVH.csproj,%SourceDir%Components\Components.csproj" "%SourceDir%PhpVH\bin\debug\phpvhm.exe" "%SourceDir%PhpVH\b.bat" 4 | CALL "%SourceDir%PhpVH\b.bat" -------------------------------------------------------------------------------- /PhpVH.SelfTest/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /PhpVH.SelfTest/NUnitResults.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Xml.Linq; 7 | 8 | namespace PhpVH.SelfTest 9 | { 10 | public class NUnitResults 11 | { 12 | private XElement _xElement; 13 | 14 | private NUnitResults() 15 | { 16 | } 17 | 18 | public static NUnitResults Load(string uri) 19 | { 20 | return new NUnitResults() 21 | { 22 | _xElement = XElement.Load(uri), 23 | }; 24 | } 25 | 26 | public IEnumerable GetTestCases() 27 | { 28 | return _xElement.Descendants("test-case"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /PhpVH.SelfTest/PhpVH.SelfTest.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /PhpVH.SelfTest/SelfTest.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Interpreter; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace PhpVH.SelfTest 9 | { 10 | public class SelfTest 11 | { 12 | [AphidProperty("name")] 13 | public string Name { get; set; } 14 | 15 | [AphidProperty("arg")] 16 | public string Arg { get; set; } 17 | 18 | [AphidProperty("msgs")] 19 | public string[] Messages { get; set; } 20 | 21 | [AphidProperty("required")] 22 | public string[] Required { get; set; } 23 | 24 | public SelfTest() 25 | { 26 | } 27 | 28 | public SelfTest(string name, string arg, string[] messages) 29 | { 30 | Name = name; 31 | Arg = arg; 32 | Messages = messages; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /PhpVH.SelfTest/SelfTestAssembly.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Interpreter; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace PhpVH.SelfTest 9 | { 10 | public class SelfTestAssembly 11 | { 12 | [AphidProperty("asm")] 13 | public string Assembly { get; set; } 14 | 15 | [AphidProperty("tests")] 16 | public SelfTest[] Tests { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /PhpVH.SelfTest/TestResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PhpVH.SelfTest 8 | { 9 | public class TestResult 10 | { 11 | public string Name { get; set; } 12 | 13 | public string Message { get; set; } 14 | 15 | public string Details { get; set; } 16 | 17 | public bool Succeeded { get; set; } 18 | 19 | public bool Skipped { get; set; } 20 | 21 | public int Passed { get; set; } 22 | 23 | public int Total { get; set; } 24 | 25 | public TestResult() 26 | { 27 | } 28 | 29 | public TestResult(string name, string message, string details, bool succeeded, int passed, int total) 30 | { 31 | Name = name; 32 | Message = message; 33 | Details = details; 34 | Succeeded = succeeded; 35 | Passed = passed; 36 | Total = total; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/ApiOverrideTester.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Components; 8 | 9 | namespace PhpVH.Tests.Integration 10 | { 11 | public class ApiOverrideTester 12 | { 13 | private string PatchCode(string code) 14 | { 15 | code = PreloadHelper.PatchArrayFunctions(""); 16 | var include = 17 | File.ReadAllText("PhpResources\\SuperGlobalOverride.php") + 18 | File.ReadAllText("PhpResources\\PhpApiOverrides.php"); 19 | code = code.Insert(6, include); 20 | return code; 21 | } 22 | 23 | public void RunBooleanOverrideTest(string template) 24 | { 25 | var tester = new PhpTester(); 26 | GetArrays().Iter(x => tester.RunBooleanTest(PatchCode(string.Format(template, x)))); 27 | } 28 | 29 | public IEnumerable GetArrays() 30 | { 31 | return Php.Superglobals.Concat(new[] { "$a" }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/ArbitraryRead/ArbitraryRead.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/ArbitraryUpload/ArbitraryUpload.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CodeCoverage/CodeCoverage.php: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CodeCoverage/CodeCoverage2.php: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CodeCoverage/CodeCoverage3.php: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CodeCoverage/CodeCoverage4.php: -------------------------------------------------------------------------------- 1 | 

Nothing to see here

-------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CommandInjection/ArbitraryCommandCookie.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CommandInjection/ArbitraryCommandGet.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CommandInjection/ArbitraryCommandGet2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CommandInjection/ArbitraryCommandPost.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/CommandInjection/ArbitraryCommandPost2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/DynamicInvocation/DynamicClass.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/DynamicInvocation/DynamicClass2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/DynamicInvocation/DynamicFunction.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/DynamicInvocation/DynamicFunction2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/FalsePositiveCheck.php: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/LocalFileInclusion/LfiCookie.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/LocalFileInclusion/LfiGet.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/LocalFileInclusion/LfiPost.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/OpenRedirect/OpenRedirect.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/OpenRedirect/OpenRedirect2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/PhpInjection/ArbitraryPhpCookie.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/PhpInjection/ArbitraryPhpGet.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/PhpInjection/ArbitraryPhpPost.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqlInjectionCookie.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqlInjectionGet.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqlInjectionGet2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqlInjectionGet3.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqlInjectionGet4.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqlInjectionGet5.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqlInjectionPost.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqliteInjectionGet.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqliteInjectionGet2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqliteInjectionGet3.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/SqlInjection/SqliteInjectionGet4.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/Xss/XssAttribute.php: -------------------------------------------------------------------------------- 1 | test'; 3 | ?> -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/Xss/XssBadFilter.php: -------------------------------------------------------------------------------- 1 | ", "", $_GET['message']); 3 | ?> -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/Xss/XssGet.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/Xss/XssGet2.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/Php/Xss/XssPost.php: -------------------------------------------------------------------------------- 1 | test'; 3 | ?> -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/PhpVH.Tests.Integration.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Integration/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/FormScraperTest.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace PhpVH.Tests.Unit 4 | { 5 | [TestFixture, Category("FormScraper")] 6 | public class FormScraperTest : HtmlTest 7 | { 8 | private FormTag[] GetForms(string testFile) 9 | { 10 | return FormScraper.GetForms(LoadResource(testFile), "GET"); 11 | } 12 | 13 | [Test] 14 | public void GetFormsTestMethod() 15 | { 16 | var forms = GetForms("Form1"); 17 | Assert.AreEqual(1, forms.Length); 18 | } 19 | 20 | [Test] 21 | public void GetInputsTestMethod() 22 | { 23 | var inputs = GetForms("Form1")[0].Inputs; 24 | Assert.AreEqual(2, inputs.Length); 25 | } 26 | 27 | [Test] 28 | public void GetAttributesTestMethod() 29 | { 30 | var inputs = GetForms("Form1")[0].Inputs; 31 | Assert.AreEqual("testType", inputs[0].Type); 32 | Assert.AreEqual("testValue", inputs[0].Value); 33 | Assert.AreEqual("testType2", inputs[1].Type); 34 | Assert.AreEqual("testValue2", inputs[1].Value); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/AbsoluteUri.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | http://localhost/foo.php 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/AbsoluteUri2.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | http://localhost/foo.php  10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/AbsoluteUri3.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | http://localhost/foo.php

shit

10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/Form1.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
11 | 15 | 19 | 21 | 22 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/JavaScriptUri.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Show alert 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/MailTo.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Mail me! 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/RelativeUri.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A link 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/RelativeUri2.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A link 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/RelativeUri3.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Html/UriLike.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | foo/bar 10 | 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/LexicalAnalysis/LexerAssert.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using NUnit.Framework; 3 | using PhpVH.LexicalAnalysis; 4 | 5 | namespace PhpVH.Tests.Unit.LexicalAnalysis 6 | { 7 | public static class LexerAssert 8 | { 9 | public static void IsEmpty(PhpLexer lexer) 10 | { 11 | CollectionAssert.AreEqual(new List(), lexer.GetTokens()); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/LexicalAnalysis/Pairs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace PhpVH.Tests.Unit.LexicalAnalysis 4 | { 5 | public class Pairs : List> 6 | { 7 | public void Add(TKey key, TValue value) 8 | { 9 | Add(new KeyValuePair(key, value)); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/LexicalAnalysis/TokenPairs.cs: -------------------------------------------------------------------------------- 1 | using PhpVH.LexicalAnalysis; 2 | 3 | namespace PhpVH.Tests.Unit.LexicalAnalysis 4 | { 5 | public class TokenPairs : Pairs { } 6 | } 7 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/Php/StaticAnalyzerSuperglobalFields.php: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/PhpVH.Tests.Unit.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /PhpVH.Tests.Unit/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /PhpVH.Tests/ExternalResourceTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace PhpVH.Tests 5 | { 6 | public abstract class ExternalResourceTest 7 | { 8 | protected abstract string GetExtension(); 9 | 10 | protected virtual string GetFolder() 11 | { 12 | return GetExtension(); 13 | } 14 | 15 | protected string LoadResource(string name) 16 | { 17 | return File.ReadAllText(string.Format( 18 | "{0}\\{1}.{2}", 19 | GetFolder(), 20 | name, 21 | GetExtension())); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /PhpVH.Tests/HtmlTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PhpVH.Tests 4 | { 5 | public abstract class HtmlTest : ExternalResourceTest 6 | { 7 | protected override string GetExtension() 8 | { 9 | return "Html"; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /PhpVH.Tests/PhpTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace PhpVH.Tests 4 | { 5 | public class PhpTest : ExternalResourceTest 6 | { 7 | protected override string GetExtension() 8 | { 9 | return "Php"; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /PhpVH.Tests/PhpVH.Tests.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /PhpVH.vssscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "1" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" 10 | } 11 | -------------------------------------------------------------------------------- /PhpVH/CodeAnalysis/Expression.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using PhpVH.LexicalAnalysis; 7 | 8 | namespace PhpVH.CodeAnalysis 9 | { 10 | public class Expression 11 | { 12 | public List Tokens { get; private set; } 13 | 14 | public Expression() 15 | { 16 | Tokens = new List(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /PhpVH/CodeAnalysis/ExpressionWalker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Components; 7 | using PhpVH.LexicalAnalysis; 8 | 9 | namespace PhpVH.CodeAnalysis 10 | { 11 | public class ExpressionWalker 12 | { 13 | private PhpToken[] _tokens; 14 | 15 | public List Analyzers { get; private set; } 16 | 17 | public ExpressionWalker(PhpToken[] tokens, params ExpressionAnalyzer[] analyzers) 18 | { 19 | Analyzers = new List(); 20 | 21 | if (analyzers != null) 22 | { 23 | Analyzers.AddRange(analyzers); 24 | } 25 | 26 | _tokens = tokens; 27 | } 28 | 29 | public void Walk() 30 | { 31 | _tokens.Iter(x => Analyzers.Iter(y => y.Analyze(x))); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /PhpVH/CodeAnalysis/PageSuperGlobalValueTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using Components; 7 | 8 | namespace PhpVH.CodeAnalysis 9 | { 10 | public class PageSuperGlobalValueTable : TableBase 11 | { 12 | public override List Items { get; protected set; } 13 | 14 | public PageSuperGlobalValueTable() 15 | { 16 | Items = new List(); 17 | } 18 | 19 | protected override string GetKey(SuperGlobalValueTable element) 20 | { 21 | return element.Filename; 22 | } 23 | 24 | protected override SuperGlobalValueTable CreateElement(string key) 25 | { 26 | return new SuperGlobalValueTable(key); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /PhpVH/CodeAnalysis/SuperGlobalNameValuePair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using System.Xml.Serialization; 7 | 8 | namespace PhpVH.CodeAnalysis 9 | { 10 | [Serializable] 11 | public class SuperGlobalNameValuePair 12 | { 13 | [XmlAttribute] 14 | public string Name { get; set; } 15 | 16 | [XmlAttribute] 17 | public string Value { get; set; } 18 | 19 | public SuperGlobalNameValuePair() 20 | { 21 | } 22 | 23 | public SuperGlobalNameValuePair(string name, string value) 24 | : this() 25 | { 26 | Name = name; 27 | Value = value; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /PhpVH/CodeAnalysis/SuperGlobalValueList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using System.Xml.Serialization; 7 | 8 | namespace PhpVH.CodeAnalysis 9 | { 10 | [Serializable] 11 | public class SuperGlobalValueList 12 | { 13 | [XmlAttribute] 14 | public string Id { get; set; } 15 | 16 | [XmlElement("NameValuePairs")] 17 | public List Values { get; private set; } 18 | 19 | public SuperGlobalValueList(string id) 20 | { 21 | Id = id; 22 | Values = new List(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /PhpVH/CodeAnalysis/SuperGlobalValueTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using System.Xml.Serialization; 7 | using Components; 8 | 9 | namespace PhpVH.CodeAnalysis 10 | { 11 | public class SuperGlobalValueTable : TableBase 12 | { 13 | [XmlAttribute] 14 | public string Filename { get; set; } 15 | 16 | [XmlElement("SuperGlobal")] 17 | public override List Items { get; protected set; } 18 | 19 | public SuperGlobalValueTable() 20 | : base() 21 | { 22 | } 23 | 24 | public SuperGlobalValueTable(string filename) 25 | : this() 26 | { 27 | Filename = filename; 28 | } 29 | 30 | protected override string GetKey(SuperGlobalValueList element) 31 | { 32 | return element.Id; 33 | } 34 | 35 | protected override SuperGlobalValueList CreateElement(string key) 36 | { 37 | return new SuperGlobalValueList(key); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /PhpVH/CodeCoverage/AnnotationFileReader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | 4 | namespace PhpVH.CodeCoverage 5 | { 6 | public class AnnotationFileReader : IFileReader 7 | { 8 | private readonly FileInfo _annotationFile; 9 | 10 | public AnnotationFileReader(FileInfo annotationFile) 11 | { 12 | _annotationFile = annotationFile; 13 | } 14 | 15 | public IEnumerable GetLines() 16 | { 17 | string entry; 18 | using (var reader = new StreamReader(_annotationFile.OpenRead())) 19 | while ((entry = reader.ReadLine()) != null) 20 | yield return entry; 21 | } 22 | 23 | public bool Exists() 24 | { 25 | return _annotationFile.Exists; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PhpVH/CodeCoverage/CodeCoverageTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using Components; 7 | 8 | namespace PhpVH.CodeCoverage 9 | { 10 | public class CodeCoverageTable : Dictionary 11 | { 12 | public string Plugin { get; set; } 13 | 14 | public decimal Total { get; set; } 15 | 16 | public override string ToString() 17 | { 18 | var s = new StringBuilder(Plugin + "\r\n"); 19 | 20 | foreach (var k in this 21 | .Concat(new[] { new KeyValuePair("Total", Total) }) 22 | .Select(x => string.Format("{0}: {1:0.##}%", x.Key, x.Value))) 23 | s.AppendLine(k); 24 | 25 | return s.ToString(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PhpVH/CodeCoverage/CodePage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace PhpVH.CodeCoverage 8 | { 9 | public class CodePage 10 | { 11 | public string Name { get; set; } 12 | public string Filename { get; set; } 13 | 14 | public CodePage() 15 | { 16 | } 17 | 18 | public CodePage(string name, string filename) 19 | { 20 | Name = name; 21 | Filename = filename; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /PhpVH/CodeCoverage/CoveragePageTemplate.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | {0} 7 | 8 | 9 | 10 | 11 | 18 | 19 | 20 | 21 | 22 |

{0} {1}

23 |
24 | {2}
25 | 
26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /PhpVH/CodeCoverage/IFileReader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace PhpVH.CodeCoverage 4 | { 5 | public interface IFileReader 6 | { 7 | IEnumerable GetLines(); 8 | 9 | bool Exists(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /PhpVH/DelimiterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace PhpVH 8 | { 9 | public enum DelimiterOptions 10 | { 11 | Parentheses, 12 | Brackets, 13 | Braces, 14 | SingleQuotes, 15 | DoubleQuotes, 16 | None, 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /PhpVH/ExeProbe.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Reflection; 7 | using System.Text; 8 | 9 | 10 | namespace PhpVH 11 | { 12 | public static class ExeProbe 13 | { 14 | private const string _probeName = "PHPVHProbe.exe"; 15 | 16 | public static void Copy() 17 | { 18 | var source = Path.Combine( 19 | Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), 20 | _probeName); 21 | 22 | 23 | var probes = new[] 24 | { 25 | Environment.SpecialFolder.System, 26 | Environment.SpecialFolder.SystemX86 27 | } 28 | .Select(Environment.GetFolderPath) 29 | .Where(Directory.Exists) 30 | .Select(x => Path.Combine(x, _probeName)) 31 | .Where(x => !File.Exists(x)); 32 | 33 | foreach (var p in probes) 34 | { 35 | Trace.WriteLine("Copying probe"); 36 | File.Copy(source, p); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /PhpVH/FileIncludeTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public class FileIncludeTable : Dictionary 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /PhpVH/FormTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public class FormTag : HtmlTag 9 | { 10 | public string Action { get; set; } 11 | 12 | public string Method { get; set; } 13 | 14 | public InputTag[] Inputs { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PhpVH/FunctionCall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using PhpVH.LexicalAnalysis; 6 | 7 | namespace PhpVH 8 | { 9 | public struct FunctionCall 10 | { 11 | public PhpToken Id; 12 | 13 | public PhpToken[] ParamTokens; 14 | 15 | public FunctionCall(PhpToken id, PhpToken[] parameters) 16 | { 17 | Id = id; 18 | ParamTokens = parameters; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /PhpVH/HtmlTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public class HtmlTag 9 | { 10 | public string Id { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /PhpVH/HttpResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public class HttpResponse 9 | { 10 | public string Header { get; set; } 11 | 12 | public string Body { get; set; } 13 | 14 | public string CompleteResponse 15 | { 16 | get { return Header + "\r\n\r\n" + Body; } 17 | } 18 | 19 | public void ParseChunkedBody(string RawBody) 20 | { 21 | Body = ""; 22 | 23 | if (RawBody == "0\r\n\r\n") 24 | return; 25 | 26 | var index = RawBody.IndexOf("\r\n"); 27 | 28 | int chunkLength = 0; 29 | while ((chunkLength = int.Parse(RawBody.Remove(index), System.Globalization.NumberStyles.HexNumber)) != 0) 30 | { 31 | Body += RawBody.Substring(index + 2, chunkLength); 32 | RawBody = RawBody.Substring(index + 4 + chunkLength); 33 | 34 | index = RawBody.IndexOf("\r\n"); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /PhpVH/InputTag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public class InputTag : HtmlTag 9 | { 10 | public string Name { get; set; } 11 | 12 | public string Value { get; set; } 13 | 14 | public string Type { get; set; } 15 | 16 | public int? Size { get; set; } 17 | 18 | public int? MaxLength { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /PhpVH/MessageDumper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | 7 | namespace PhpVH 8 | { 9 | public class MessageDumper 10 | { 11 | private DirectoryInfo _dumpDirectory; 12 | 13 | public MessageDumper(string path) 14 | { 15 | _dumpDirectory = new DirectoryInfo(path + @"\Messages"); 16 | 17 | if (!_dumpDirectory.Exists) 18 | _dumpDirectory.Create(); 19 | } 20 | 21 | public void Dump(string Message, int Number, MessageType Type) 22 | { 23 | var name = Number.ToString() + "_" + Type + ".txt"; 24 | 25 | File.WriteAllText(_dumpDirectory.FullName + "\\" + name, 26 | Message); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /PhpVH/MessageType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace PhpVH 8 | { 9 | public enum MessageType 10 | { 11 | Request, 12 | Response 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /PhpVH/MimeTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public static class MimeTypes 9 | { 10 | public const string Gif = "image/gif"; 11 | 12 | public const string Jpg = "image/jpeg"; 13 | 14 | public const string TextXml = "text/xml"; 15 | 16 | public const string TextPlain = "text/plain"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /PhpVH/PageFieldTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public class PageFieldTable : Dictionary>> 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /PhpVH/Php.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace PhpVH 8 | { 9 | public static class Php 10 | { 11 | public const string NonNameStartRegex = @"([^a-zA-Z_\x7f-\xff])"; 12 | 13 | public const string NonNameEndRegex = @"([^a-zA-Z0-9_\x7f-\xff])"; 14 | 15 | public const string ValidNameRegex = @"[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"; 16 | 17 | public const string ValidNameEndRegex = @"[a-zA-Z0-9_\x7f-\xff]"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /PhpVH/PhpResource.cs: -------------------------------------------------------------------------------- 1 | using Components; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | 9 | namespace PhpVH 10 | { 11 | public static class PhpResource 12 | { 13 | private const string ResourcePath = "PhpResources"; 14 | 15 | public static string Load(string name) 16 | { 17 | var asms = AppDomain.CurrentDomain.GetAssemblies(); 18 | var dir = Directory.GetCurrentDirectory(); 19 | var filename = string.Format("{0}.php", name); 20 | var searchPaths = new[] 21 | { 22 | PathHelper.GetExecutingPath(ResourcePath, filename), 23 | Path.Combine(Directory.GetCurrentDirectory(), ResourcePath, filename) 24 | }; 25 | 26 | foreach (var p in searchPaths) 27 | { 28 | if (File.Exists(p)) 29 | { 30 | return File.ReadAllText(p); 31 | } 32 | } 33 | 34 | throw new FileNotFoundException(string.Format("Could not find PHP resource {0}.", filename)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /PhpVH/PhpResources/Annotation.php: -------------------------------------------------------------------------------- 1 | 2 | $annotationArray = NULL; 3 | 4 | $annotationHandle = NULL; 5 | 6 | function Annotation($id) 7 | { 8 | global $annotationArray; 9 | global $annotationHandle; 10 | 11 | if ($annotationHandle == NULL) { 12 | $annotationHandle = fopen($_SERVER['DOCUMENT_ROOT'] . '/annotation.txt', 'a') or die('error opening annotation file'); 13 | /*$annotationArray = explode("\n", $contents);*/ 14 | } 15 | 16 | /* 17 | if (in_array($id, $annotationArray)) 18 | return; 19 | 20 | 21 | array_push($annotationArray, $id); 22 | */ 23 | 24 | fwrite($annotationHandle, $id . "\n"); 25 | 26 | //fclose($f); 27 | } 28 | -------------------------------------------------------------------------------- /PhpVH/PhpResources/DynamicProbes.php: -------------------------------------------------------------------------------- 1 | 2 | class DynamicClassProbe { 3 | function __construct() { 4 | echo 'DynamicClassProbe Instantiated'; 5 | } 6 | } 7 | 8 | function DynamicFunctionProbe() { 9 | echo 'DynamicFunctionProbe Called'; 10 | } 11 | -------------------------------------------------------------------------------- /PhpVH/PhpResources/VersionProbe.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /PhpVH/PhpVH.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /PhpVH/ReportFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Serialization; 6 | using Components; 7 | 8 | namespace PhpVH 9 | { 10 | [Serializable] 11 | public class ReportFile 12 | { 13 | public string Name { get; set; } 14 | 15 | public string Filename { get; set; } 16 | 17 | public ReportFile() { } 18 | 19 | public ReportFile(string name, string filename) 20 | { 21 | Name = name; 22 | Filename = filename; 23 | } 24 | 25 | public static ReportFile[] Load(string filename) 26 | { 27 | return new XmlSerializer(typeof(ReportFile[])).Deserialize(filename) 28 | as ReportFile[]; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /PhpVH/ScanAlertOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace PhpVH 8 | { 9 | public enum ScanAlertOptions 10 | { 11 | RequestData, 12 | Warning, 13 | Vulnerability 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /PhpVH/ScanMetrics.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | using System.IO; 7 | using PhpVH.LexicalAnalysis; 8 | using PhpVH.CodeCoverage; 9 | using System.Web; 10 | using Components; 11 | 12 | namespace PhpVH 13 | { 14 | public class ScanMetrics 15 | { 16 | public static ScanMetrics Default = new ScanMetrics(); 17 | 18 | public Annotator Annotator { get; set; } 19 | 20 | public PluginAnnotationTable PluginAnnotations { get; set; } 21 | 22 | public ScanMetrics() 23 | { 24 | PluginAnnotations = new PluginAnnotationTable(); 25 | Annotator = new Annotator(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/ArbitraryPhpScanConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Serialization; 6 | 7 | namespace PhpVH.ScanPlugins 8 | { 9 | [Serializable] 10 | public class ArbitraryPhpScanConfig : PluginConfig 11 | { 12 | [XmlElement] 13 | public string FalsePositiveRegex { get; set; } 14 | 15 | [XmlElement] 16 | public string MatchRegex { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/ArbitraryPhpScanPlugin.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | <?php echo 'testabc'.'testxyz'; ?> 4 | echo 'testabc'.'testxyz'; 5 | <?php echo "testabc"."testxyz"; ?> 6 | echo "testabc"."testxyz"; 7 | echo.{0,2}testabctestxyz 8 | testabctestxyz 9 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/Command.alx: -------------------------------------------------------------------------------- 1 | #'Std'; 2 | 3 | probeName = 'PHPVHProbe'; 4 | prefixes = [ '', '|', '||', '&', '\r\n' ]; 5 | suffixes = [ '', chr(0) ]; 6 | 7 | ret { 8 | probeName: probeName, 9 | testCases: prefixes.selectMany(@(x)suffixes.select(@(y)x+probeName+y)), 10 | functions: [ 'system', 'exec', 'shell_exec', 'passthru' ] 11 | }; -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/CommandScanConfig.cs: -------------------------------------------------------------------------------- 1 | using Components.Aphid.Interpreter; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Xml.Serialization; 7 | 8 | namespace PhpVH.ScanPlugins 9 | { 10 | [Serializable] 11 | public class CommandScanConfig 12 | { 13 | [AphidProperty("probeName")] 14 | public string ProbeName { get; set; } 15 | 16 | [AphidProperty("testCases")] 17 | public string[] TestCases { get; set; } 18 | 19 | [AphidProperty("functions")] 20 | public string[] Functions { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/ConfigurableScanPluginBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Xml.Serialization; 7 | using Components; 8 | 9 | namespace PhpVH.ScanPlugins 10 | { 11 | public abstract class ConfigurableScanPluginBase : ScanPluginBase 12 | where TConfig : class 13 | { 14 | public TConfig Config { get; private set; } 15 | 16 | public ConfigurableScanPluginBase() 17 | : base() 18 | { 19 | } 20 | 21 | protected TConfig DeserializeConfig() 22 | { 23 | var filename = ".\\ScanPlugins\\" + GetType().Name + ".xml"; 24 | 25 | if (File.Exists(filename)) 26 | { 27 | var serializer = new XmlSerializer(typeof(TConfig)); 28 | return serializer.Deserialize(filename) as TConfig; 29 | } 30 | else 31 | return null; 32 | } 33 | 34 | protected abstract void InitializeCore(); 35 | 36 | public override void Initialize() 37 | { 38 | Config = DeserializeConfig(); 39 | InitializeCore(); 40 | 41 | base.Initialize(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/IEnumerableSqlFunctionExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace PhpVH.ScanPlugins 8 | { 9 | public static class IEnumerableSqlFunctionExtension 10 | { 11 | public static Hook[] ToHooks(this IEnumerable functions) 12 | { 13 | return functions.Select(x => new Hook(x.Name, x.ParamCount)).ToArray(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/LocalFileInclusion.alx: -------------------------------------------------------------------------------- 1 | #'Std'; 2 | 3 | slashes = [ '\\', '/' ]; 4 | dotLens = [ 2, 6 ]; 5 | travSeqLens = [ 8, 32 ]; 6 | exts = [ 'jpg' ]; 7 | probe = 'lfi_test.txt'; 8 | 9 | travSeqs = dotLens 10 | .selectMany(@(x)slashes 11 | .select(@(y)'.'*x+y) 12 | .selectMany(@(x)travSeqLens.select(@(y)x*y+probe))); 13 | 14 | if (exts? && exts.any()) 15 | travSeqs = travSeqs 16 | .selectMany(@(x)exts.select(@(y)x+chr(0)+'.'+y)) 17 | .concat(travSeqs); 18 | 19 | ret travSeqs.distinct(); -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/PluginConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Serialization; 6 | 7 | namespace PhpVH.ScanPlugins 8 | { 9 | [Serializable] 10 | public abstract class PluginConfig 11 | { 12 | [XmlElement("FuzzString")] 13 | public string[] FuzzStrings { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/ScanPluginBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using PhpVH.CodeAnalysis; 6 | 7 | namespace PhpVH.ScanPlugins 8 | { 9 | public abstract class ScanPluginBase 10 | { 11 | private RequestBuilder _requestBuilder = new RequestBuilder(); 12 | 13 | public RequestBuilder RequestBuilder 14 | { 15 | get { return _requestBuilder; } 16 | } 17 | 18 | public abstract int ModeCount { get; } 19 | 20 | public abstract string Server { get; set; } 21 | 22 | protected abstract string BuildRequestCore(int Mode, string TargetFile, FileTrace SourceTrace); 23 | 24 | public string BuildRequest(int Mode, string TargetFile, FileTrace SourceTrace) 25 | { 26 | _requestBuilder.Calls = SourceTrace.Calls; 27 | 28 | return BuildRequestCore(Mode, TargetFile, SourceTrace); 29 | } 30 | 31 | protected abstract ScanAlert ScanTraceCore(FileTrace TargetTrace); 32 | 33 | public ScanAlert ScanTrace(FileTrace targetTrace) 34 | { 35 | return ScanTraceCore(targetTrace); 36 | } 37 | 38 | public virtual void Initialize() { } 39 | 40 | public virtual void Uninitialize() { } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/SqlFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | using System.Xml.Serialization; 7 | 8 | namespace PhpVH.ScanPlugins 9 | { 10 | [Serializable] 11 | public class SqlFunction 12 | { 13 | [XmlAttribute] 14 | public string Name { get; set; } 15 | 16 | [XmlAttribute] 17 | public int ParamCount { get; set; } 18 | 19 | [XmlAttribute] 20 | public int QueryParam { get; set; } 21 | 22 | public SqlFunction() 23 | { 24 | } 25 | 26 | public SqlFunction(string name, int paramCount, int queryParam) 27 | : this() 28 | { 29 | Name = name; 30 | ParamCount = paramCount; 31 | QueryParam = queryParam; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/SqlScanConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Serialization; 6 | 7 | namespace PhpVH.ScanPlugins 8 | { 9 | [Serializable] 10 | public class SqlScanConfig : PluginConfig 11 | { 12 | [XmlElement("SqlFunction")] 13 | public SqlFunction[] Functions { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/Xss.alx: -------------------------------------------------------------------------------- 1 | ret [ 2 | '', 3 | 'iPt>alert(0)iPt>', 4 | '"OnMoUsEoVeR="alert(0)', 5 | '"OnBlUr="alert(0)' 6 | ]; -------------------------------------------------------------------------------- /PhpVH/ScanPlugins/XssScanConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.ScanPlugins 7 | { 8 | [Serializable] 9 | public class XssScanConfig : PluginConfig 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/ArbitraryUploadPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.StaticAnalysis 7 | { 8 | public class ArbitraryUploadPlugin : InsecureCallPlugin 9 | { 10 | protected override IEnumerable GetFunctions() 11 | { 12 | return new[] { "move_uploaded_file", "fopen" }; 13 | } 14 | 15 | protected override string Name 16 | { 17 | get { return "Arbitrary upload"; } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/CommandInjectionPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | 7 | namespace PhpVH.StaticAnalysis 8 | { 9 | public class CommandInjectionPlugin : InsecureCallPlugin 10 | { 11 | protected override IEnumerable GetFunctions() 12 | { 13 | var c = new ScanPlugins.CommandScanPlugin(null); 14 | c.Initialize(); 15 | return c.Config.Functions; 16 | } 17 | 18 | protected override string[] GetSanitizationFunctions() 19 | { 20 | return new[] { "escapeshellarg" }; 21 | } 22 | 23 | protected override string Name 24 | { 25 | get { return "Command injection"; } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/CommandInjectionPlugin2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using PhpVH.LexicalAnalysis; 6 | 7 | namespace PhpVH.StaticAnalysis 8 | { 9 | public class CommandInjectionPlugin2 : StaticAnalysisPlugin 10 | { 11 | protected override string Name 12 | { 13 | get { return "Command injection"; } 14 | } 15 | 16 | public override StaticAnalysisAlert[] GetAlerts(string code, PhpToken[] tokens) 17 | { 18 | return tokens 19 | .Where(x => 20 | x.TokenType == PhpTokenType.BacktickString && 21 | PhpName.Superglobals 22 | .Any(y => x.Lexeme.Contains(y))) 23 | .Select(x => CreateAlert(code, x)) 24 | .ToArray(); 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/ExtractPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.StaticAnalysis 7 | { 8 | public class ExtractPlugin : InsecureCallPlugin 9 | { 10 | protected override IEnumerable GetFunctions() 11 | { 12 | return new[] { "extract" }; 13 | } 14 | 15 | protected override string Name 16 | { 17 | get { return "Insecure extract usage"; } 18 | } 19 | 20 | protected override string[] GetSanitizationFunctions() 21 | { 22 | return new[] 23 | { 24 | "EXTR_SKIP", 25 | "EXTR_PREFIX_SAME", 26 | "EXTR_PREFIX_ALL", 27 | }; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/LfiPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.StaticAnalysis 7 | { 8 | public class LfiPlugin : InsecureCallPlugin 9 | { 10 | protected override IEnumerable GetFunctions() 11 | { 12 | return new[] 13 | { 14 | "require", 15 | "require_once", 16 | "include", 17 | "include_once", 18 | }; 19 | } 20 | 21 | protected override string Name 22 | { 23 | get { return "Local file inclusion"; } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/OpenRedirectPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using PhpVH.LexicalAnalysis; 6 | 7 | namespace PhpVH.StaticAnalysis 8 | { 9 | public class OpenRedirectPlugin : InsecureCallPlugin 10 | { 11 | protected override IEnumerable GetFunctions() 12 | { 13 | return new[] { "header" }; 14 | } 15 | 16 | protected override bool IsCallInsecure(FunctionCall call) 17 | { 18 | return base.IsCallInsecure(call) && call.ParamTokens 19 | .Any(x => (x.TokenType == PhpTokenType.String || x.TokenType == PhpTokenType.HereDocString) && 20 | x.Lexeme.ToLower().Contains("location:") && 21 | (PhpName.Superglobals 22 | .Any(y => x.Lexeme.Contains(y)) || 23 | call.ParamTokens 24 | .Any(y => y.TokenType == PhpTokenType.Variable && PhpName.Superglobals 25 | .Any(z => y.Lexeme.Contains(z))))); 26 | } 27 | 28 | protected override string Name 29 | { 30 | get { return "Open redirect"; } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/PhpInjectionPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.StaticAnalysis 7 | { 8 | public class PhpInjectionPlugin : InsecureCallPlugin 9 | { 10 | protected override IEnumerable GetFunctions() 11 | { 12 | return new[] { PhpName.Eval }; 13 | } 14 | 15 | protected override string[] GetSanitizationFunctions() 16 | { 17 | return new[] { PhpName.HtmlEntities }; 18 | } 19 | 20 | protected override string Name 21 | { 22 | get { return "PHP injection"; } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/SqlInjectionPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using PhpVH.LexicalAnalysis; 6 | 7 | namespace PhpVH.StaticAnalysis 8 | { 9 | public class SqlInjectionPlugin : InsecureCallPlugin 10 | { 11 | protected override IEnumerable GetFunctions() 12 | { 13 | var plugin = new PhpVH.ScanPlugins.SqlScanPlugin(null); 14 | plugin.Initialize(); 15 | 16 | return plugin.Config.Functions.Select(x => x.Name); 17 | } 18 | 19 | protected override string[] GetSanitizationFunctions() 20 | { 21 | return new[] 22 | { 23 | "mysql_escape_string", 24 | "mysqli_escape_string", 25 | "sqlite_escape_string", 26 | "mysql_real_escape_string", 27 | "pg_escape_string", 28 | "addslashes" 29 | }; 30 | } 31 | 32 | protected override string Name 33 | { 34 | get { return "SQL Injection"; } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/StaticAnalysisAlert.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.StaticAnalysis 7 | { 8 | public class StaticAnalysisAlert 9 | { 10 | public string Name { get; set; } 11 | 12 | public int Line { get; set; } 13 | 14 | public string CodeExcerpt { get; set; } 15 | 16 | public StaticAnalysisAlert(string name, int line, string codeExcerpt) 17 | { 18 | Name = name; 19 | Line = line; 20 | CodeExcerpt = codeExcerpt; 21 | } 22 | 23 | public StaticAnalysisAlert() 24 | { 25 | } 26 | 27 | public override string ToString() 28 | { 29 | return string.Format("{0}\r\n{1}\r\n\r\n", Name, CodeExcerpt); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/StaticAnalysisFileAlerts.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.StaticAnalysis 7 | { 8 | public class StaticAnalysisFileAlerts 9 | { 10 | public string Filename { get; set; } 11 | public StaticAnalysisAlert[] Alerts { get; set; } 12 | 13 | public StaticAnalysisFileAlerts(string filename, StaticAnalysisAlert[] alerts) 14 | { 15 | Filename = filename; 16 | Alerts = alerts; 17 | } 18 | 19 | public StaticAnalysisFileAlerts() 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/StaticAnalysisPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using PhpVH.LexicalAnalysis; 7 | using Components; 8 | 9 | namespace PhpVH.StaticAnalysis 10 | { 11 | public abstract class StaticAnalysisPlugin 12 | { 13 | protected abstract string Name { get; } 14 | 15 | public abstract StaticAnalysisAlert[] GetAlerts(string code, PhpToken[] tokens); 16 | 17 | protected string GetSurroundingCode(string code, PhpToken token) 18 | { 19 | var line = code.GetLineNumber(token.Index); 20 | var code2 = code.InsertLineNumbers(); 21 | var index = code2.GetLineIndex(line); 22 | 23 | return code2.GetSurroundingLines(index, 9, 9); 24 | } 25 | 26 | protected StaticAnalysisAlert CreateAlert(string code, PhpToken token) 27 | { 28 | return new StaticAnalysisAlert(Name, 29 | code.GetLineNumber(token.Index) + 1, 30 | GetSurroundingCode(code, token)); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /PhpVH/StaticAnalysis/XssScanPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH.StaticAnalysis 7 | { 8 | public class XssScanPlugin : InsecureCallPlugin 9 | { 10 | protected override IEnumerable GetFunctions() 11 | { 12 | return new[] 13 | { 14 | "echo", 15 | "print", 16 | "printf", 17 | "vprintf", 18 | }; 19 | } 20 | 21 | protected override string Name 22 | { 23 | get { return "Cross-site scripting"; } 24 | } 25 | 26 | protected override string[] GetSanitizationFunctions() 27 | { 28 | return new[] 29 | { 30 | "htmlentities", 31 | "htmlspecialchars", 32 | }; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /PhpVH/StringSanitizer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace PhpVH 7 | { 8 | public static class StringSanitizer 9 | { 10 | public unsafe static string RemoveBeeps(string text) 11 | { 12 | fixed (char* t = text) 13 | { 14 | for (int x = 0; x < text.Length; x++) 15 | if (t[x] == (char)7) 16 | t[x] = ' '; 17 | 18 | return text; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003, 2004 Jim Weirich 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/config.rb: -------------------------------------------------------------------------------- 1 | environment = :production 2 | project_type = :stand_alone 3 | http_path = "/" 4 | css_dir = "../styles" 5 | sass_dir = "." 6 | images_dir = "images" 7 | sass_options = { 8 | :line_numbers => false, 9 | :debug_info => false 10 | } 11 | 12 | # output_style = :compressed 13 | # output_style = :compact 14 | output_style = :expanded 15 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreDefault.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeDefault.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreDjango.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeDjango.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreEclipse.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeEclipse.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreEmacs.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeEmacs.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreFadeToGrey.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeFadeToGrey.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreMDUltra.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeMDUltra.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreMidnight.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeMidnight.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shCoreRDark.scss: -------------------------------------------------------------------------------- 1 | @import "shCore.scss"; 2 | @import "shThemeRDark.scss"; 3 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shThemeDefault.scss: -------------------------------------------------------------------------------- 1 | // Default Syntax Highlighter theme. 2 | 3 | @import "_theme_template.scss"; 4 | 5 | .syntaxhighlighter { 6 | .keyword { font-weight: bold !important; } 7 | } 8 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shThemeDjango.scss: -------------------------------------------------------------------------------- 1 | // Django SyntaxHighlighter theme 2 | 3 | $background: #0a2b1d !default; 4 | 5 | $line_highlighted_background: #233729 !default; 6 | $line_highlighted_number: white !default; 7 | 8 | $gutter_text: #497958 !default; 9 | $gutter_border_color: #41a83e !default; 10 | 11 | $toolbar_collapsed_a: #96dd3b !default; 12 | $toolbar_collapsed_a_hover: #fff !default; 13 | $toolbar_collapsed_background: #000 !default; 14 | 15 | $toolbar_a: #fff !default; 16 | $toolbar_a_hover: #ffe862 !default; 17 | 18 | $code_plain: #f8f8f8 !default; 19 | $code_comments: #336442 !default; 20 | $code_string: #9df39f !default; 21 | $code_keyword: #96dd3b !default; 22 | $code_preprocessor: #91bb9e !default; 23 | $code_variable: #ffaa3e !default; 24 | $code_value: #f7e741 !default; 25 | $code_functions: #ffaa3e !default; 26 | $code_constants: #e0e8ff !default; 27 | $code_color1: #eb939a !default; 28 | $code_color2: #91bb9e !default; 29 | $code_color3: #edef7d !default; 30 | 31 | @import "_theme_template.scss"; 32 | 33 | .syntaxhighlighter { 34 | .comments { font-style: italic !important; } 35 | .keyword { font-weight: bold !important; } 36 | } 37 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shThemeEmacs.scss: -------------------------------------------------------------------------------- 1 | // Emacs SyntaxHighlighter theme based on theme by Joshua Emmons 2 | // http://www.skia.net/ 3 | 4 | $background: black !default; 5 | 6 | $line_highlighted_background: #2A3133 !default; 7 | $line_highlighted_number: white !default; 8 | 9 | $gutter_text: #d3d3d3 !default; 10 | $gutter_border_color: #990000 !default; 11 | 12 | $toolbar_collapsed_a: #ebdb8d !default; 13 | $toolbar_collapsed_a_hover: #ff7d27 !default; 14 | $toolbar_collapsed_background: black !default; 15 | 16 | $toolbar_a: #fff !default; 17 | $toolbar_a_hover: #9ccff4 !default; 18 | 19 | $code_plain: #d3d3d3 !default; 20 | $code_comments: #ff7d27 !default; 21 | $code_string: #ff9e7b !default; 22 | $code_keyword: aqua !default; 23 | $code_preprocessor: #aec4de !default; 24 | $code_variable: #ffaa3e !default; 25 | $code_value: #009900 !default; 26 | $code_functions: #81cef9 !default; 27 | $code_constants: #ff9e7b !default; 28 | $code_color1: #ebdb8d !default; 29 | $code_color2: #ff7d27 !default; 30 | $code_color3: #aec4de !default; 31 | 32 | @import "_theme_template.scss"; 33 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shThemeFadeToGrey.scss: -------------------------------------------------------------------------------- 1 | // Fade to Grey SyntaxHighlighter theme based on theme by Brasten Sager 2 | // :http//www.ibrasten.com/ 3 | 4 | $background: #121212 !default; 5 | 6 | $line_highlighted_background: #2C2C29 !default; 7 | $line_highlighted_number: white !default; 8 | 9 | $gutter_text: #afafaf !default; 10 | $gutter_border_color: #3185b9 !default; 11 | 12 | $toolbar_collapsed_a: #3185b9 !default; 13 | $toolbar_collapsed_a_hover: #d01d33 !default; 14 | $toolbar_collapsed_background: black !default; 15 | 16 | $toolbar_a: #fff !default; 17 | $toolbar_a_hover: #96daff !default; 18 | 19 | $code_plain: white !default; 20 | $code_comments: #696854 !default; 21 | $code_string: #e3e658 !default; 22 | $code_keyword: #d01d33 !default; 23 | $code_preprocessor: #435a5f !default; 24 | $code_variable: #898989 !default; 25 | $code_value: #009900 !default; 26 | $code_functions: #aaaaaa !default; 27 | $code_constants: #96daff !default; 28 | $code_color1: #ffc074 !default; 29 | $code_color2: #4a8cdb !default; 30 | $code_color3: #96daff !default; 31 | 32 | @import "_theme_template.scss"; 33 | 34 | .syntaxhighlighter { 35 | .functions { font-weight: bold !important; } 36 | } 37 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shThemeMDUltra.scss: -------------------------------------------------------------------------------- 1 | // MDUltra SyntaxHighlighter theme based on Midnight Theme 2 | // http://www.mddev.co.uk/ 3 | 4 | $background: #222222 !default; 5 | 6 | $line_highlighted_background: #253e5a !default; 7 | $line_highlighted_number: white !default; 8 | 9 | $gutter_text: #38566f !default; 10 | $gutter_border_color: #435a5f !default; 11 | 12 | $toolbar_collapsed_a: #428bdd !default; 13 | $toolbar_collapsed_a_hover: lime !default; 14 | $toolbar_collapsed_background: black !default; 15 | 16 | $toolbar_a: #aaaaff !default; 17 | $toolbar_a_hover: #9ccff4 !default; 18 | 19 | $code_plain: lime !default; 20 | $code_comments: #428bdd !default; 21 | $code_string: lime !default; 22 | $code_keyword: #aaaaff !default; 23 | $code_preprocessor: #8aa6c1 !default; 24 | $code_variable: aqua !default; 25 | $code_value: #f7e741 !default; 26 | $code_functions: #ff8000 !default; 27 | $code_constants: yellow !default; 28 | $code_color1: red !default; 29 | $code_color2: yellow !default; 30 | $code_color3: #ffaa3e !default; 31 | 32 | @import "_theme_template.scss"; 33 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shThemeMidnight.scss: -------------------------------------------------------------------------------- 1 | // Midnight SyntaxHighlighter theme based on theme by J.D. Myers 2 | // http://webdesign.lsnjd.com/ 3 | 4 | $background: #0f192a !default; 5 | 6 | $line_highlighted_background: #253e5a !default; 7 | $line_highlighted_number: #38566f !default; 8 | 9 | $gutter_text: #afafaf !default; 10 | $gutter_border_color: #435a5f !default; 11 | 12 | $toolbar_collapsed_a: #428bdd !default; 13 | $toolbar_collapsed_a_hover: #1dc116 !default; 14 | $toolbar_collapsed_background: #000 !default; 15 | 16 | $toolbar_a: #D1EDFF !default; 17 | $toolbar_a_hover: #8aa6c1 !default; 18 | 19 | $code_plain: #d1edff !default; 20 | $code_comments: #428bdd !default; 21 | $code_string: #1dc116 !default; 22 | $code_keyword: #b43d3d !default; 23 | $code_preprocessor: #8aa6c1 !default; 24 | $code_variable: #ffaa3e !default; 25 | $code_value: #f7e741 !default; 26 | $code_functions: #ffaa3e !default; 27 | $code_constants: #e0e8ff !default; 28 | $code_color1: #f8bb00 !default; 29 | $code_color2: white !default; 30 | $code_color3: #ffaa3e !default; 31 | 32 | @import "_theme_template.scss"; 33 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/compass/shThemeRDark.scss: -------------------------------------------------------------------------------- 1 | // RDark SyntaxHighlighter theme based on theme by Radu Dineiu 2 | // http://www.vim.org/scripts/script.php?script_id=1732 3 | 4 | $background: #1b2426 !default; 5 | 6 | $line_highlighted_background: #323E41 !default; 7 | $line_highlighted_number: #b9bdb6 !default; 8 | 9 | $gutter_text: #afafaf !default; 10 | $gutter_border_color: #435a5f !default; 11 | 12 | $toolbar_collapsed_a: #5ba1cf !default; 13 | $toolbar_collapsed_a_hover: #5ce638 !default; 14 | $toolbar_collapsed_background: #000 !default; 15 | 16 | $toolbar_a: #fff !default; 17 | $toolbar_a_hover: #e0e8ff !default; 18 | 19 | $code_plain: #b9bdb6 !default; 20 | $code_comments: #878a85 !default; 21 | $code_string: #5ce638 !default; 22 | $code_keyword: #5ba1cf !default; 23 | $code_preprocessor: #435a5f !default; 24 | $code_variable: #ffaa3e !default; 25 | $code_value: #009900 !default; 26 | $code_functions: #ffaa3e !default; 27 | $code_constants: #e0e8ff !default; 28 | $code_color1: #e0e8ff !default; 29 | $code_color2: white !default; 30 | $code_color3: #ffaa3e !default; 31 | 32 | @import "_theme_template.scss"; 33 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/scripts/shBrushDiff.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | this.regexList = [ 25 | { regex: /^\+\+\+.*$/gm, css: 'color2' }, 26 | { regex: /^\-\-\-.*$/gm, css: 'color2' }, 27 | { regex: /^\s.*$/gm, css: 'color1' }, 28 | { regex: /^@@.*@@$/gm, css: 'variable' }, 29 | { regex: /^\+[^\+]{1}.*$/gm, css: 'string' }, 30 | { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' } 31 | ]; 32 | }; 33 | 34 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 35 | Brush.aliases = ['diff', 'patch']; 36 | 37 | SyntaxHighlighter.brushes.Diff = Brush; 38 | 39 | // CommonJS 40 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 41 | })(); 42 | -------------------------------------------------------------------------------- /PhpVH/SyntaxHighlighter/scripts/shBrushPlain.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/SyntaxHighlighter 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/SyntaxHighlighter/donate.html 7 | * 8 | * @version 9 | * 3.0.83 (July 02 2010) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2010 Alex Gorbatchev. 13 | * 14 | * @license 15 | * Dual licensed under the MIT and GPL licenses. 16 | */ 17 | ;(function() 18 | { 19 | // CommonJS 20 | typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null; 21 | 22 | function Brush() 23 | { 24 | }; 25 | 26 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 27 | Brush.aliases = ['text', 'plain']; 28 | 29 | SyntaxHighlighter.brushes.Plain = Brush; 30 | 31 | // CommonJS 32 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 33 | })(); 34 | -------------------------------------------------------------------------------- /PhpVH/Todo.txt: -------------------------------------------------------------------------------- 1 | Inline annotation calls -------------------------------------------------------------------------------- /PhpVH/TraceTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using PhpVH.ScanPlugins; 6 | 7 | namespace PhpVH 8 | { 9 | public class TraceTable : Dictionary>> 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /PhpVH/TracedFunctionCall.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web; 6 | using System.Xml.Serialization; 7 | 8 | namespace PhpVH 9 | { 10 | public static class FunctionCallExtension 11 | { 12 | public static IEnumerable Superglobals(this IEnumerable Calls) 13 | { 14 | return Calls.Where(x => PhpName.Superglobals.Contains(x.Name)); 15 | } 16 | 17 | 18 | } 19 | 20 | [Serializable] 21 | public class TracedFunctionCall 22 | { 23 | private string _name; 24 | 25 | [XmlAttribute] 26 | public string Name 27 | { 28 | get { return _name; } 29 | set { _name = value; } 30 | } 31 | 32 | private List _parameterValues = new List(); 33 | 34 | [XmlElement] 35 | public List ParameterValues 36 | { 37 | get { return _parameterValues; } 38 | set { _parameterValues = value; } 39 | } 40 | 41 | private string _value; 42 | 43 | [XmlElement] 44 | public string Value 45 | { 46 | get { return _value; } 47 | set { _value = value; } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /PhpVH/UriScraperModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | 7 | 8 | namespace PhpVH 9 | { 10 | public class UriScraperModule 11 | { 12 | public Regex Regex { get; set; } 13 | 14 | public Func ProcessCore { get; set; } 15 | 16 | public UriScraperModule(string pattern, Func processCore) 17 | { 18 | Regex = new Regex( 19 | pattern, 20 | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.Compiled); 21 | ProcessCore = processCore; 22 | } 23 | 24 | public IEnumerable Process(string html) 25 | { 26 | var matches = Regex 27 | .Matches(html) 28 | .OfType(); 29 | 30 | return matches.Select(ProcessCore); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /PhpVH/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /PhpVHGui/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /PhpVHGui/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Windows; 6 | 7 | namespace PHPVHGUI 8 | { 9 | /// 10 | /// Interaction logic for App.xaml 11 | /// 12 | public partial class App : Application 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /PhpVHGui/Content/Images/PHPVHGuide-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robocoder/phpvh/4bf4d4a2a3dcf0d5f0a446c604a9e696ea2c65f5/PhpVHGui/Content/Images/PHPVHGuide-1.png -------------------------------------------------------------------------------- /PhpVHGui/DialogWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 24 | 25 |