mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Oxygene language detection
This commit is contained in:
		| @@ -923,6 +923,13 @@ OpenEdge ABL: | ||||
|   - abl | ||||
|   primary_extension: .p | ||||
|  | ||||
| Oxygene: | ||||
|   type: programming | ||||
|   color: "#5a63a3" | ||||
|   primary_extension: .pas | ||||
|   extensions: | ||||
|   - .oxygene | ||||
|  | ||||
| PHP: | ||||
|   type: programming | ||||
|   ace_mode: php | ||||
|   | ||||
							
								
								
									
										55
									
								
								samples/Oxygene/Loops.oxygene
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								samples/Oxygene/Loops.oxygene
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <PropertyGroup> | ||||
|     <RootNamespace>Loops</RootNamespace> | ||||
|     <OutputType>exe</OutputType> | ||||
|     <AssemblyName>Loops</AssemblyName> | ||||
|     <AllowGlobals>False</AllowGlobals> | ||||
|     <AllowLegacyOutParams>False</AllowLegacyOutParams> | ||||
|     <AllowLegacyCreate>False</AllowLegacyCreate> | ||||
|     <ApplicationIcon>Properties\App.ico</ApplicationIcon> | ||||
|     <Configuration Condition="'$(Configuration)' == ''">Release</Configuration> | ||||
|     <ProjectGuid>{916BD89C-B610-4CEE-9CAF-C515D88E2C94}</ProjectGuid> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||||
|     <DefineConstants>DEBUG;TRACE;</DefineConstants> | ||||
|     <OutputPath>.\bin\Debug</OutputPath> | ||||
|     <GeneratePDB>True</GeneratePDB> | ||||
|     <GenerateMDB>True</GenerateMDB> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||||
|     <OutputPath>.\bin\Release</OutputPath> | ||||
|     <EnableAsserts>False</EnableAsserts> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(MSBuildExtensionsPath)\RemObjects Software\Oxygene\RemObjects.Oxygene.targets" /> | ||||
|   <ItemGroup> | ||||
|     <Reference Include="mscorlib"> | ||||
|       <HintPath>$(Framework)\mscorlib.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System"> | ||||
|       <HintPath>$(Framework)\System.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System.Core"> | ||||
|       <HintPath>$(ProgramFiles)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll</HintPath> | ||||
|       <Private>True</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="System.Data"> | ||||
|       <HintPath>$(Framework)\System.Data.dll</HintPath> | ||||
|     </Reference> | ||||
|     <Reference Include="System.Xml"> | ||||
|       <HintPath>$(Framework)\System.Xml.dll</HintPath> | ||||
|     </Reference> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Compile Include="Program.pas" /> | ||||
|     <Content Include="Properties\App.ico" /> | ||||
|     <Compile Include="Properties\AssemblyInfo.pas" /> | ||||
|     <EmbeddResource Include="Properties\Resources.resx"> | ||||
|       <Generator>ResXFileCodeGenerator</Generator> | ||||
|     </EmbeddResource> | ||||
|     <Compile Include="Properties\Resources.Designer.pas" /> | ||||
|     <None Include="Properties\Settings.settings"> | ||||
|       <Generator>SettingsSingleFileGenerator</Generator> | ||||
|     </None> | ||||
|     <Compile Include="Properties\Settings.Designer.pas" /> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										125
									
								
								samples/Oxygene/Program.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								samples/Oxygene/Program.pas
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,125 @@ | ||||
| namespace Loops; | ||||
|  | ||||
| interface | ||||
|  | ||||
| uses System.Linq; | ||||
|  | ||||
| type | ||||
|   ConsoleApp = class | ||||
|   public | ||||
|     class method Main; | ||||
|     method loopsTesting; | ||||
|     method fillData : sequence of Country; | ||||
|   var  | ||||
|     Countries : sequence of Country; | ||||
|   end; | ||||
|  | ||||
| type  | ||||
|   Country = public class | ||||
|   public | ||||
|     property Name : String; | ||||
|     property Capital : String; | ||||
|  | ||||
|     constructor (setName : String; setCapital : String); | ||||
|   end; | ||||
| implementation | ||||
|  | ||||
| class method ConsoleApp.Main; | ||||
| begin | ||||
|   Console.WriteLine('Loops example'); | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   with myConsoleApp := new ConsoleApp() do | ||||
|      myConsoleApp.loopsTesting; | ||||
| end; | ||||
|  | ||||
| method ConsoleApp.loopsTesting; | ||||
| begin | ||||
|   {---------------------------------} | ||||
|   {"for" loop, taking every 5th item} | ||||
|   for i : Int32 :=0 to 50 step 5 do  | ||||
|   begin | ||||
|     Console.Write(i); Console.Write(' '); | ||||
|   end; | ||||
|  | ||||
|   Console.WriteLine(); Console.WriteLine(); | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {"for" loop, going from high to low value} | ||||
|   for i : Int32 := 10 downto 1 do | ||||
|   begin | ||||
|     Console.Write(i); Console.Write(' '); | ||||
|   end; | ||||
|  | ||||
|   Console.WriteLine(); Console.WriteLine(); | ||||
|  | ||||
|   Countries := fillData; | ||||
|    | ||||
|   {---------------------------------} | ||||
|   {loop with defined "index" variable, which will count from 0 through the number of elements looped} | ||||
|   Console.WriteLine('Countries: '); | ||||
|   for each c in Countries index num do  | ||||
|     Console.WriteLine(Convert.ToString(num + 1) + ') ' + c.Name); | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   Console.WriteLine('Cities: '); | ||||
|   var ind : Integer :=0; | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {simple "loop" construct that loops endlessly, until broken out of} | ||||
|   loop | ||||
|   begin | ||||
|     Console.WriteLine(Countries.ElementAt(ind).Capital); | ||||
|     Inc(ind); | ||||
|     if ind = Countries.Count then break; | ||||
|   end; | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {the type of 'c' is inferred automatically} | ||||
|   for each c in Countries do | ||||
|     Console.WriteLine(c.Capital + ' is the capital of ' + c.Name); | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   ind := 0; | ||||
|   Console.WriteLine('Cities: '); | ||||
|  | ||||
|   {"repeat ... until" loop} | ||||
|   repeat  | ||||
|     Console.WriteLine(Countries.ElementAt(ind).Capital); | ||||
|     Inc(ind); | ||||
|   until ind = Countries.Count; | ||||
|  | ||||
|   Console.WriteLine(); | ||||
|  | ||||
|   ind := 0; | ||||
|   Console.WriteLine('Countries: '); | ||||
|  | ||||
|   {---------------------------------} | ||||
|   {"while ... do" loop} | ||||
|   while ind < Countries.Count do | ||||
|   begin | ||||
|     Console.WriteLine(Countries.ElementAt(ind).Name); | ||||
|     Inc(ind); | ||||
|   end; | ||||
|  | ||||
|   Console.ReadLine(); | ||||
| end; | ||||
|  | ||||
| method ConsoleApp.fillData: sequence of Country; | ||||
| begin | ||||
|   result := [new Country('UK', 'London'), new Country('USA', 'Washington'), new Country('Germany', 'Berlin'),  | ||||
|              new Country('Ukraine', 'Kyiv'), new Country('Russia', 'Moscow'), new Country('France', 'Paris')]; | ||||
|               | ||||
| end; | ||||
|  | ||||
| constructor Country (setName :String; setCapital: String); | ||||
| begin | ||||
|   Name := setName; | ||||
|   Capital := setCapital; | ||||
| end; | ||||
|  | ||||
| end. | ||||
		Reference in New Issue
	
	Block a user