Skip to content

Commit

Permalink
Added support for Visual Studio reference syntax for ease of IntelliS…
Browse files Browse the repository at this point in the history
…ense support.
  • Loading branch information
Sebastian Markbage committed Nov 2, 2010
1 parent ec3557f commit 9b9e12c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Src/Calyptus.ResourceManager/Helpers/SyntaxReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public SyntaxReader(TextReader textReader, bool parseSingleLineComments, IResour
_baseLocation = baseLocation;
_ext = defaultExtension;

_parser = new Regex("(?:^|\\s)\\@(include|import|build|compress)[\\(\\s]\\s*[\\'\\\"]?((?<=\\\")[^\\\"]*(?=\\\")|(?<=\\')[^\\']*(?=\\')|[^\\s\\'\\;\\)\\,]+)[\\'\\\"]?\\s*(?:,\\s*[\\'\\\"]?((?<=\\\")[^\\\"]*(?=\\\")|(?<=\\')[^\\']*(?=\\')|[^\\s\\'\\;\\)\\,]+)[\\'\\\"]?)?\\s*(?:,\\s*[\\'\\\"]?((?<=\\\")[^\\\"]*(?=\\\")|(?<=\\')[^\\']*(?=\\')|[^\\s\\'\\;\\)\\,]+)[\\'\\\"]?)?\\s*[\\)\\n\\;]", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline);
_parser = new Regex("(?:^|\\s)\\@(include|import|build|compress)[\\(\\s]\\s*[\\'\\\"]?((?<=\\\")[^\\\"]*(?=\\\")|(?<=\\')[^\\']*(?=\\')|[^\\s\\'\\;\\)\\,]+)[\\'\\\"]?\\s*(?:,\\s*[\\'\\\"]?((?<=\\\")[^\\\"]*(?=\\\")|(?<=\\')[^\\']*(?=\\')|[^\\s\\'\\;\\)\\,]+)[\\'\\\"]?)?\\s*(?:,\\s*[\\'\\\"]?((?<=\\\")[^\\\"]*(?=\\\")|(?<=\\')[^\\']*(?=\\')|[^\\s\\'\\;\\)\\,]+)[\\'\\\"]?)?\\s*[\\)\\n\\;]|^[ \\t]*\\<reference(?:[^\\>]+?(?:assembly=\"([^\"]+)\"|(?:name|path)=\"([^\"]+)\"))+[^\\>]*\\>", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline);

_includes = new List<IResourceLocation>();
_references = new List<IResourceLocation>();
Expand Down Expand Up @@ -68,6 +68,18 @@ private void ParseBlock(string block)
{
foreach (Match m in _parser.Matches(block))
{
if (m.Groups[6].Success)
{
var assembly = m.Groups[5].Success ? m.Groups[5].Value : null;
var path = m.Groups[6].Value;
IEnumerable<IResourceLocation> ls = ResourceLocations.GetLocations(_baseLocation, assembly, path);
if (ls == null && assembly == null && _ext != null && !path.EndsWith("*") && !path.Equals(_ext, StringComparison.OrdinalIgnoreCase))
ls = ResourceLocations.GetLocations(_baseLocation, null, path + _ext);
if (ls != null)
_references.AddRange(ls);
continue;
}

string command = m.Groups[1].Value;
string param1 = m.Groups[2].Success ? m.Groups[2].Value : null;
string param2 = m.Groups[3].Success ? m.Groups[3].Value : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
<ItemGroup>
<Content Include="Content\DependentStyle.css" />
<Content Include="Global.asax" />
<EmbeddedResource Include="Scripts\embedded2.js" />
<EmbeddedResource Include="Scripts\embedded1.js" />
<Content Include="Scripts\dependent.js" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference path="jquery-1.4.1.js" />
/// <reference name="Calyptus.ResourceManager.SampleWebMvc.Scripts.embedded1.js" assembly="Calyptus.ResourceManager.SampleWebMvc" />
/// <reference assembly="Calyptus.ResourceManager.SampleWebMvc" name="Calyptus.ResourceManager.SampleWebMvc.Scripts.embedded2.js" />

var Dependent = { EA: EmbeddedA, EB: EmbeddedB };
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var EmbeddedA = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var EmbeddedB = {};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<title>@View.Title</title>
@Html.Import("~/Content/Site.css")
@Html.Import("~/Scripts/dependent.js")
<!-- <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />-->
</head>

Expand Down

0 comments on commit 9b9e12c

Please sign in to comment.