ConceptCore/scripts/BuildLexers.ps1

29 lines
835 B
PowerShell
Raw Normal View History

2024-04-15 22:16:14 +03:00
# Generate lexers for RSlang
$workDir = Resolve-Path -Path "${PSScriptRoot}\..\ccl\rslang\src"
2024-07-14 12:30:40 +03:00
# Change default relative path according to your work directory setup
# Re-flex repository: https://github.com/Genivia/RE-flex
$reflexRelative = Resolve-Path -Path "${PSScriptRoot}\..\..\GH-RE-flex\bin\win64"
$Env:PATH += ";${reflexRelative}"
2024-04-15 22:16:14 +03:00
function BuildLexers {
Set-Location -Path ${workDir}
BuildSyntax('AsciiLexer')
BuildSyntax('MathLexer')
Write-Host 'Building lexers complete'
Exit 0
}
function BuildSyntax([string] $lexerName) {
$lexer = "${lexerName}Impl"
Write-Host "Building ${lexer}"
& reflex "${lexer}.l"
if ($LASTEXITCODE -ne 0) {
Write-Error 'Please add path to reflex.exe to PATH variable'
Exit 1
}
Move-Item -Path "${lexer}.hpp" -Destination "..\header\${lexer}.hpp" -Force
}
2024-07-14 12:30:40 +03:00
BuildLexers