Compiler/Preprocessor: Difference between revisions
Content added Content deleted
(julia example) |
m (remove unused code) |
||
Line 63: | Line 63: | ||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
<lang ruby>""" Rosetta Code task Compiler/Preprocessor task """ |
<lang ruby>""" Rosetta Code task Compiler/Preprocessor task """ |
||
""" if Char can be used in identifier """ |
|||
isidentifierchar(c) = isletter(c) || isnumeric(c) || (c == '_') |
|||
""" If this is an identifier, all Chars are valid identifier Chars and first is nonnumeric """ |
|||
isidentifier(s) = s != "" && !isnumeric([1]) && all(isidentifierchar, s) |
|||
""" If the line is a macro definition, add the macro to macros. """ |
""" If the line is a macro definition, add the macro to macros. """ |
||
Line 187: | Line 180: | ||
end |
end |
||
""" Process command line, open files if needed, hand off to function `func`, close files """ |
|||
function runwithopts(func, minargs = 0, maxargs = 3) |
function runwithopts(func, minargs = 0, maxargs = 3) |
||
minargs <= length(ARGS) <= maxargs || error("Wrong number of arguments ($minargs:$maxargs)") |
minargs <= length(ARGS) <= maxargs || error("Wrong number of arguments ($minargs:$maxargs)") |
||
Line 209: | Line 203: | ||
runwithopts(preprocess) |
runwithopts(preprocess) |
||
</lang>{{out}} Same output as Phix entry. |
</lang>{{out}} Same output as Phix entry. |
||
=={{header|Phix}}== |
=={{header|Phix}}== |