I was hoping I wouldn't have to parse the text directly, but thanks for this
solution anyway, it will certainly suffice :)
-------- Original Message --------
On February 1, 2018 11:43 PM, John Benediktsson <mrj...@gmail.com> wrote:
> You could use regexp maybe.
>
> "resource:core/math/math.factor" utf8 file-contents
> R/ USING:(\s+[^;]+)+\s+;/ all-matching-subseqs
> [ "USING:" ?head drop ";" ?tail drop " " split harvest ] map concat
>
> We have the using list available at parse time but I don't think it's stored
> anywhere in the vocab thats created.
>
> Usually the USING: list is pretty much everything, but some other forms are
> used occasionally that you might want to also parse to have the fullest
> picture:
>
> USE: vocab
> UNUSE: vocab
> FROM: vocab => words ... ;
> EXCLUDE: vocab => word ... ;
> QUALIFIED: vocab
> QUALIFIED-WITH: vocab name
>
> Also, you vocabs and their private vocab maybe should be merged:
>
> [ ".private" ?tail drop ] map members
>
> On Thu, Feb 1, 2018 at 6:06 PM, cat via Factor-talk
> <factor-talk@lists.sourceforge.net> wrote:
>
>> Hi,
>> I am interested in creating a Factor linter which warns about vocabularies
>> which are referenced in a USE: / USING: statement, but which are never used
>> in the code. I have played around with some code based on the USING: syntax
>> definition, but it is not very reliable. There is probably a better way.
>>
>> What is the simplest and most idiomatic way to get the vocabularies named by
>> a USING: statement in an input string or source file?
>>
>> Thanks, ~cat
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk