ben_josephs wrote:skaemper wrote:there should be the possibility to set a special key word in the highlighting file
The identifier
include is not a keyword in C or C++, and it cannot, on its own, be used to identify a reference to another file. There is no confusion in the following:
skaemper wrote:Hope I didn't mess up things even more with this posting
No. You just provided an opportunity for some more clarification
Good.
Now, I seem to have to set up some kind of generic terms to describe my idea. I'll do that without getting too formal.
Let's focus on programming languages where source files are read from text files (otherwise using TextPad wouldn't make too much sense after all
). Now, let's call the elements in these files
tokens - no matter whether they are key words of that specific language, precompiler directives, methods of an object, functions, variable identifiers or what not.
In every language there are tokens which are used to refer to another source file. The 'typical' layout is:
Code: Select all
file_refer_token whithespace pre_delimiter whithespace file_identifer whitespace post_delimiter whithespace
Some of the white space is usually optional, and in the more highlevel language there's not restriction of where to put the reference to the other file.
One problem I see are languages where the file_identifier may be any
expression which yields a, say, string. That may be a
variable name, a conditional expression or even an appropriate SQL query...
I wouldn't expect TextPad to solve that, because the editor just
can't now it - I can't because it's only known at runtime.
BTW, most of the tokens in the C++ syntax definition file cpp.syn of TextPad aren't C++ key words, nevertheless they're placed in the sections [Keyword
num] in the syntax file.
May idea is to have a key/value(s) pair in a syntax definition file to set a token, and another key/value pair to extract the file name form the whole contruction.
Code: Select all
ReferenceToken=include load, require
ReferendeDelimiter={},[],().<>,'',"",//
As I think of it, from this information TextPad should be able to generate an appropriate regular expression itself. 8)
Now, before this posting mutates into a complete essay, I'll just finish mentioning that I'm well awre of the fact that every answer raises even more questions...
Cheers
Stephan
PS: Loading 'system' files wouldn't be too easy that way anyway, since the system files/header (e.g. the STL stuff for C++) a usually not given whit a full path name, but the file name only. The languages themselves usually know where to look for those files, but you'd have to teach TextPad to do that somehow.
That'll get really interesting the moment you use more than one compiler system...